A problem
-
I create a windows form apllication, p2pport. My form file name is Dlg.I get some errors. error C2027: use of undefined type 'p2pport::CParams' error C2227: left of '->setValue' must point to class/struct/union/generic type in Dlg.cpp
params->setValue("Y", "123");
in my Dlg.h file#include "params.h"; namespace p2pport { using namespace System; ............................... public ref class Dlg : public System::Windows::Forms::Form { CParams* params; } }
in my param.h fileclass CParams{ void setvalue(char* k, char* v); }
in my params.cppvoid CParams::setValue(char* k, char* v){ ..... return; }
Can anybody tell me what's wrong with it? Appreciate your reply. Jane -
I create a windows form apllication, p2pport. My form file name is Dlg.I get some errors. error C2027: use of undefined type 'p2pport::CParams' error C2227: left of '->setValue' must point to class/struct/union/generic type in Dlg.cpp
params->setValue("Y", "123");
in my Dlg.h file#include "params.h"; namespace p2pport { using namespace System; ............................... public ref class Dlg : public System::Windows::Forms::Form { CParams* params; } }
in my param.h fileclass CParams{ void setvalue(char* k, char* v); }
in my params.cppvoid CParams::setValue(char* k, char* v){ ..... return; }
Can anybody tell me what's wrong with it? Appreciate your reply. JaneHave you declared the pointer to your class before using it?
#include "MyClass.h"
MyClass* pMC;
pMC->DoSomething (...);will work, but...
#include "MyClass.h"
pMC->DoSomething (...);
will give you the error you are posting
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)
-
I create a windows form apllication, p2pport. My form file name is Dlg.I get some errors. error C2027: use of undefined type 'p2pport::CParams' error C2227: left of '->setValue' must point to class/struct/union/generic type in Dlg.cpp
params->setValue("Y", "123");
in my Dlg.h file#include "params.h"; namespace p2pport { using namespace System; ............................... public ref class Dlg : public System::Windows::Forms::Form { CParams* params; } }
in my param.h fileclass CParams{ void setvalue(char* k, char* v); }
in my params.cppvoid CParams::setValue(char* k, char* v){ ..... return; }
Can anybody tell me what's wrong with it? Appreciate your reply. Janethis is a Managed C++ question, so you should ask in the C++/CLI Forum[^] thanks
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Have you declared the pointer to your class before using it?
#include "MyClass.h"
MyClass* pMC;
pMC->DoSomething (...);will work, but...
#include "MyClass.h"
pMC->DoSomething (...);
will give you the error you are posting
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)
-
THx for reply. Is that means I can't declare it in Dlg.h? I have to put "MyClass* pMC;" to Dlg.cpp? Jane
I dont say that you can not, I made it in header with member variables and in code with the local variables. I have given you an example of that error code and the meaning. I don't think just putting the MyClass* pMC; in your Dlg.cpp will solve it. Although you can try it as well. I think is more a question about the scope and how the relationships between classes are done. Your code is not recognising the other class, there is a point where the connections break.
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)