#include "stdafx.h"
#include "Form1.h"
using namespace test;
class DoStuff{
int nr1, nr2;
public:
void SetStuff(System::Windows::Forms::Button a);
};
void DoStuff::SetStuff(System::Windows::Forms::Button a) {
a.Text = "text";
}
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
and my form that looks like this (just done a button and dubbleklicked it to get this function)...
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
DoStuff d;
d.SetStuff(this->button1);
}
But I get the following errors,
Error 1 error C2065: 'DoStuff' : undeclared identifier Form1.h
Error 2 error C2146: syntax error : missing ';' before identifier 'd' Form1.h
Error 3 error C2065: 'd' : undeclared identifier Form1.h
Error 4 error C2065: 'd' : undeclared identifier Form1.h
Error 5 error C2228: left of '.SetStuff' must have class/struct/union Form1.h
I guess I make something wrong when initializing my Class in the other file or something like that, would really like some help :)
/nick3


Sign In
Create Account


Back to top









