Monday, 26 August 2013

Put the code from a FORM in a .cpp file

Put the code from a FORM in a .cpp file

I have a form created in this way (the .h file of form is named Example):
This is a default code from a form:
namespace ExampleNamespace{
public ref class Example : public System::Windows::Forms::Form
{
public:
void DoSomething()
{
// code here
}
};
}
I can to this ?
Creating a new .cpp file and named Example.cpp am put here all the code
from the form in .cpp ? In this way don't work.
namespace ExampleNamespace{
public ref class Example : public System::Windows::Forms::Form
{
public:
void DoSomething(); //if i try in this way I will have the error
from above
};
}
and in Example.cpp
#include "Example.h"
void Example::DoSomething()
{
//code here
}
If I try to add public: void doSomething(); in form i have this error:
error LNK2020: unresolved token (060000BB)
ExampleNamespace.Example::doSomething

No comments:

Post a Comment