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. Undeclared identifier

Undeclared identifier

Scheduled Pinned Locked Moved C / C++ / MFC
helpcomquestion
18 Posts 6 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
    manu_2205
    wrote on last edited by
    #1

    Hello. I'm having a problem instantiating a COLeVariant object. The snippet of code that fails is: void CMyDoc::CreateIEObject() { m_pIE = new CWebBrowserApp; // this is a COLeDispatchDriver derived class... GOOD m_pIE->CreateDispatch("InternetExplorer.Application"); // GOOD COLeVariant noArg; // this does not work // BAD! m_pIE->Navigate("www.yahoo.com", noArg, noArg, noArg, noArg); // BAD! m_pIE->SetVisible(TRUE); // GOOD } The function is supposed to instantiate an IE browser and go to the webpage specified in Navigate. I get the following compile errors: : error C2065: 'COLeVariant' : undeclared identifier : error C2146: syntax error : missing ';' before identifier 'noArg' : error C2065: 'noArg' : undeclared identifier I have included in file. I have verified that COLeVariant is defined in afxdisp.h. What could I be doing wrong?

    manu

    P 1 Reply Last reply
    0
    • M manu_2205

      Hello. I'm having a problem instantiating a COLeVariant object. The snippet of code that fails is: void CMyDoc::CreateIEObject() { m_pIE = new CWebBrowserApp; // this is a COLeDispatchDriver derived class... GOOD m_pIE->CreateDispatch("InternetExplorer.Application"); // GOOD COLeVariant noArg; // this does not work // BAD! m_pIE->Navigate("www.yahoo.com", noArg, noArg, noArg, noArg); // BAD! m_pIE->SetVisible(TRUE); // GOOD } The function is supposed to instantiate an IE browser and go to the webpage specified in Navigate. I get the following compile errors: : error C2065: 'COLeVariant' : undeclared identifier : error C2146: syntax error : missing ';' before identifier 'noArg' : error C2065: 'noArg' : undeclared identifier I have included in file. I have verified that COLeVariant is defined in afxdisp.h. What could I be doing wrong?

      manu

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      manu_2205 wrote:

      COLeVariant noArg; // this does not work // BAD!

      Because , it must be CO**l**eVariant not CO**L**eVariant.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      H M 2 Replies Last reply
      0
      • P prasad_som

        manu_2205 wrote:

        COLeVariant noArg; // this does not work // BAD!

        Because , it must be CO**l**eVariant not CO**L**eVariant.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        On previous message he writes COleVariant :)


        WhiteSky


        1 Reply Last reply
        0
        • P prasad_som

          manu_2205 wrote:

          COLeVariant noArg; // this does not work // BAD!

          Because , it must be CO**l**eVariant not CO**L**eVariant.

          Prasad Notifier using ATL | Operator new[],delete[][^]

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

          i changed COLeVariant to COleVariant Still now it generate compile time error.

          manu

          P 1 Reply Last reply
          0
          • M manu_2205

            i changed COLeVariant to COleVariant Still now it generate compile time error.

            manu

            P Offline
            P Offline
            prasad_som
            wrote on last edited by
            #5

            manu_2205 wrote:

            Still now it generate compile time error

            What ? Is the error same as above ?

            Prasad Notifier using ATL | Operator new[],delete[][^]

            M 1 Reply Last reply
            0
            • P prasad_som

              manu_2205 wrote:

              Still now it generate compile time error

              What ? Is the error same as above ?

              Prasad Notifier using ATL | Operator new[],delete[][^]

              M Offline
              M Offline
              manu_2205
              wrote on last edited by
              #6

              yes sir

              manu

              M 1 Reply Last reply
              0
              • M manu_2205

                yes sir

                manu

                M Offline
                M Offline
                manu_2205
                wrote on last edited by
                #7

                Plz help me .My project is near to end .I am just waiting to rectify this error.Plz tell me Either I have to add some another .h file or not ? Or any suggestion . Plz tell

                manu

                R C 2 Replies Last reply
                0
                • M manu_2205

                  Plz help me .My project is near to end .I am just waiting to rectify this error.Plz tell me Either I have to add some another .h file or not ? Or any suggestion . Plz tell

                  manu

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #8

                  You're surely wrong somewhere. Post the code that you've got currently. Please use the <pre> </pre> tags when posting code.


                  Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                  M 1 Reply Last reply
                  0
                  • R Rajesh R Subramanian

                    You're surely wrong somewhere. Post the code that you've got currently. Please use the <pre> </pre> tags when posting code.


                    Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                    M Offline
                    M Offline
                    manu_2205
                    wrote on last edited by
                    #9

                    void CMyDoc::CreateIEObject() { m_pIE = new CWebBrowserApp; // this is a COLeDispatchDriver derived class... GOOD m_pIE->CreateDispatch("InternetExplorer.Application"); // GOOD COleVariant noArg; // this does not work // BAD! m_pIE->Navigate("www.yahoo.com", noArg, noArg, noArg, noArg); // BAD! m_pIE->SetVisible(TRUE); // GOOD } The function is supposed to instantiate an IE browser and go to the webpage specified in Navigate. I get the following compile errors: : error C2065: 'COLeVariant' : undeclared identifier : error C2146: syntax error : missing ';' before identifier 'noArg' : error C2065: 'noArg' : undeclared identifier I have included in file. I have verified that COleVariant is defined in afxdisp.h. What could I be doing wrong? manu

                    manu

                    R 2 2 Replies Last reply
                    0
                    • M manu_2205

                      void CMyDoc::CreateIEObject() { m_pIE = new CWebBrowserApp; // this is a COLeDispatchDriver derived class... GOOD m_pIE->CreateDispatch("InternetExplorer.Application"); // GOOD COleVariant noArg; // this does not work // BAD! m_pIE->Navigate("www.yahoo.com", noArg, noArg, noArg, noArg); // BAD! m_pIE->SetVisible(TRUE); // GOOD } The function is supposed to instantiate an IE browser and go to the webpage specified in Navigate. I get the following compile errors: : error C2065: 'COLeVariant' : undeclared identifier : error C2146: syntax error : missing ';' before identifier 'noArg' : error C2065: 'noArg' : undeclared identifier I have included in file. I have verified that COleVariant is defined in afxdisp.h. What could I be doing wrong? manu

                      manu

                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #10

                      #include "afxdisp.h" is what you need. You clearly have not included afxdisp.h


                      Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                      M 1 Reply Last reply
                      0
                      • R Rajesh R Subramanian

                        #include "afxdisp.h" is what you need. You clearly have not included afxdisp.h


                        Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                        M Offline
                        M Offline
                        manu_2205
                        wrote on last edited by
                        #11

                        still the problem remains same. I also write a small program that uses 'COleVariant' class. It also have same problem Plz check it to wtite a hello program Plz. I got confused what the problem is . Plz suggest me.If ur code succedd plz send me . Thanx in advance;

                        manu

                        R 1 Reply Last reply
                        0
                        • M manu_2205

                          still the problem remains same. I also write a small program that uses 'COleVariant' class. It also have same problem Plz check it to wtite a hello program Plz. I got confused what the problem is . Plz suggest me.If ur code succedd plz send me . Thanx in advance;

                          manu

                          R Offline
                          R Offline
                          Rajesh R Subramanian
                          wrote on last edited by
                          #12

                          Make sure that you have got the header file afxdisp.h in the default include directory. Try hardcoding the path of the file while including it. I am not able to think of any other reason. Is the compiler warning about afxdisp.h that it is not present?


                          Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                          M 1 Reply Last reply
                          0
                          • R Rajesh R Subramanian

                            Make sure that you have got the header file afxdisp.h in the default include directory. Try hardcoding the path of the file while including it. I am not able to think of any other reason. Is the compiler warning about afxdisp.h that it is not present?


                            Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                            M Offline
                            M Offline
                            manu_2205
                            wrote on last edited by
                            #13

                            Ya it is in default include directory. Even i not include the .h file it produce the same error. I have VS2003 and project type is win32 console project. Is this create any problem ?

                            manu

                            P 1 Reply Last reply
                            0
                            • M manu_2205

                              Ya it is in default include directory. Even i not include the .h file it produce the same error. I have VS2003 and project type is win32 console project. Is this create any problem ?

                              manu

                              P Offline
                              P Offline
                              prasad_som
                              wrote on last edited by
                              #14

                              manu_2205 wrote:

                              I have VS2003 and project type is win32 console project. Is this create any problem ?

                              Yes, it will. You need to create porject with MFC support.

                              Prasad Notifier using ATL | Operator new[],delete[][^]

                              1 Reply Last reply
                              0
                              • M manu_2205

                                void CMyDoc::CreateIEObject() { m_pIE = new CWebBrowserApp; // this is a COLeDispatchDriver derived class... GOOD m_pIE->CreateDispatch("InternetExplorer.Application"); // GOOD COleVariant noArg; // this does not work // BAD! m_pIE->Navigate("www.yahoo.com", noArg, noArg, noArg, noArg); // BAD! m_pIE->SetVisible(TRUE); // GOOD } The function is supposed to instantiate an IE browser and go to the webpage specified in Navigate. I get the following compile errors: : error C2065: 'COLeVariant' : undeclared identifier : error C2146: syntax error : missing ';' before identifier 'noArg' : error C2065: 'noArg' : undeclared identifier I have included in file. I have verified that COleVariant is defined in afxdisp.h. What could I be doing wrong? manu

                                manu

                                2 Offline
                                2 Offline
                                224917
                                wrote on last edited by
                                #15

                                manu_2205 wrote:

                                : error C2065: 'COLeVariant' : undeclared identifier

                                Error still says 'COLeVariant' !

                                1 Reply Last reply
                                0
                                • M manu_2205

                                  Plz help me .My project is near to end .I am just waiting to rectify this error.Plz tell me Either I have to add some another .h file or not ? Or any suggestion . Plz tell

                                  manu

                                  C Offline
                                  C Offline
                                  Cristian Amarie
                                  wrote on last edited by
                                  #16

                                  Include afxdisp.h

                                  H 1 Reply Last reply
                                  0
                                  • C Cristian Amarie

                                    Include afxdisp.h

                                    H Offline
                                    H Offline
                                    Hamid Taebi
                                    wrote on last edited by
                                    #17

                                    Hi Cristian, He includes this file but also he gets this error, anyway I dont know why you get vote 1


                                    WhiteSky


                                    C 1 Reply Last reply
                                    0
                                    • H Hamid Taebi

                                      Hi Cristian, He includes this file but also he gets this error, anyway I dont know why you get vote 1


                                      WhiteSky


                                      C Offline
                                      C Offline
                                      Cristian Amarie
                                      wrote on last edited by
                                      #18

                                      Don't bother, is easier to vote 1 than to fix the ***** code, isn't it? :D Anyway, I see a full thread just because COLeVaRIanT is not defined in afxdisp.h or something.

                                      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