Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. A problem

A problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    minihotto
    wrote on last edited by
    #1

    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 file class CParams{ void setvalue(char* k, char* v); } in my params.cpp void CParams::setValue(char* k, char* v){ ..... return; } Can anybody tell me what's wrong with it? Appreciate your reply. Jane

    T N 2 Replies Last reply
    0
    • M minihotto

      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 file class CParams{ void setvalue(char* k, char* v); } in my params.cpp void CParams::setValue(char* k, char* v){ ..... return; } Can anybody tell me what's wrong with it? Appreciate your reply. Jane

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      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 ;)

      M 1 Reply Last reply
      0
      • M minihotto

        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 file class CParams{ void setvalue(char* k, char* v); } in my params.cpp void CParams::setValue(char* k, char* v){ ..... return; } Can anybody tell me what's wrong with it? Appreciate your reply. Jane

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        this is a Managed C++ question, so you should ask in the C++/CLI Forum[^] thanks


        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        1 Reply Last reply
        0
        • N Nelek

          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 ;)

          M Offline
          M Offline
          minihotto
          wrote on last edited by
          #4

          THx for reply. Is that means I can't declare it in Dlg.h? I have to put "MyClass* pMC;" to Dlg.cpp? Jane

          N 1 Reply Last reply
          0
          • M minihotto

            THx for reply. Is that means I can't declare it in Dlg.h? I have to put "MyClass* pMC;" to Dlg.cpp? Jane

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            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 ;)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups