Undeclared identifier in header files
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: Undeclared identifier in header files

  1. #1
    Join Date
    Apr 2009
    Posts
    8

    Undeclared identifier in header files

    Hi

    As my title says I have this error, but I'm wondering because these header files are built in header files not customize.

    here are the errors
    Code:
    --------------------Configuration: NewServer - Win32 Debug--------------------
    Compiling...
    StdAfx.cpp
    c:\program files\microsoft visual studio\vc98\include\basetyps.h(149) : warning C4005: 'interface' : macro redefinition
            c:\program files\microsoft visual studio 8\vc\platformsdk\include\objbase.h(193) : see previous definition of 'interface'
    c:\program files\microsoft visual studio\vc98\include\basetyps.h(155) : warning C4005: 'DECLARE_INTERFACE' : macro redefinition
            c:\program files\microsoft visual studio 8\vc\platformsdk\include\objbase.h(201) : see previous definition of 'DECLARE_INTERFACE'
    c:\program files\microsoft visual studio\vc98\include\basetyps.h(156) : warning C4005: 'DECLARE_INTERFACE_' : macro redefinition
            c:\program files\microsoft visual studio 8\vc\platformsdk\include\objbase.h(202) : see previous definition of 'DECLARE_INTERFACE_'
    Compiling...
    ChattingDlg.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    ClientSocket.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\iostream.h(58) : fatal error C1083: Cannot open include file: 'ostream.h': No such file or directory
    ClientUser.cpp
    c:\program files\microsoft visual studio\vc98\include\iostream.h(58) : fatal error C1083: Cannot open include file: 'ostream.h': No such file or directory
    ConnectThread.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    Lib.cpp
    c:\program files\microsoft visual studio\vc98\include\iostream.h(58) : fatal error C1083: Cannot open include file: 'ostream.h': No such file or directory
    ListeningSocket.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    LoginDlg.cpp
    Machine.cpp
    MainFrm.cpp
    NetData.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    NetDataCtl.cpp
    NewServer.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    NewServerDoc.cpp
    NewServerView.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\iostream.h(58) : fatal error C1083: Cannot open include file: 'ostream.h': No such file or directory
    OptionDlg.cpp
    ReportCtrl.cpp
    RoomDlg.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    SqlDB.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\iostream.h(58) : fatal error C1083: Cannot open include file: 'ostream.h': No such file or directory
    SrvEventSink.cpp
    UserInfo.cpp
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    Generating Code...
    If I run the original code in release code the program works fine, but if i try to rebuild the project then those errors will popup and I don't know why as they are built in header files.

    I'm just new to visual c or even to c although I have basic c knowledge, but I know it's not enough. I'm a vb programmer so debugging a program that I don't really understand is very frustrating, I know it's suicide, but I don't have a choice. Right now I need to make it run that's all I need to workout at the moment, so if some one can point me to the right direction I would highly appreciate it.

    Many thanks
    Dennis

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Undeclared identifier in header files

    What are you trying to build? It looks like you're not including some files, or they don't exist. Where is IAsyncSetup defined, for instance?
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Apr 2009
    Posts
    8

    Re: Undeclared identifier in header files

    Do I need to define it? They are built in header files in Visual C++ I though the type variable or what ever declaration the built in header file has don't need to be declared or defined? unless it's a user define header. Am I missing something?

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Undeclared identifier in header files

    No, but the right headers need to be included. In the right order.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    Apr 2009
    Posts
    8

    Re: Undeclared identifier in header files

    I though it should be taking care of by visual c++ itself since it is a built in header files?

    if it should be included in the correct order what header files should be included before the basetyps.h so on and so forth?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Undeclared identifier in header files

    Quote Originally Posted by Dennis_R View Post
    here are the errors
    Code:
    --------------------Configuration: NewServer - Win32 Debug--------------------
    Compiling...
    StdAfx.cpp
    c:\program files\microsoft visual studio\vc98\include\basetyps.h(149) : warning C4005: 'interface' : macro redefinition
            c:\program files\microsoft visual studio 8\vc\platformsdk\include\objbase.h(193) : see previous definition of 'interface'
    ...
    Why do you mix the VC98 (VC++6.0) code with a "microsoft visual studio 8" PSDK code?
    I guess it is NOT allowed!
    Victor Nijegorodov

  7. #7
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Undeclared identifier in header files

    Good catch there. Their not compatible.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  8. #8
    Join Date
    Apr 2009
    Posts
    8

    Re: Undeclared identifier in header files

    Quote Originally Posted by VictorN View Post
    Why do you mix the VC98 (VC++6.0) code with a "microsoft visual studio 8" PSDK code?
    I guess it is NOT allowed!
    Let's forget about the include files in the platformsdk folder. This is not my source code it was given to us by one of our client to debug, but they didn't give us the dependencies.

    hmmm.... so it's not compatible... I'll remove the platform folder in my include files.

    Any suggestion where can I find the header files in the platform folder that is compatible with visual c++ 6?

    Ok back to the topic. Any ideas about undeclared identifier error?
    Last edited by Dennis_R; April 27th, 2009 at 07:48 AM.

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Undeclared identifier in header files

    Quote Originally Posted by Dennis_R View Post
    Any suggestion where can I find the header files in the platform folder that is compatible with visual c++ 6?
    If you meant "what PSDK is compatible with visual c++ 6" then the answer would be:
    The last PSDK compatible with visual c++ 6 is the one from February 2003

    Quote Originally Posted by Dennis_R View Post
    Ok back to the topic. Any ideas about the errors? What are the possible causes of these errors?
    You must first correct this platform incompatibility.
    Then we could look at the other problems (if any).
    Victor Nijegorodov

  10. #10
    Join Date
    Apr 2009
    Posts
    8

    Re: Undeclared identifier in header files

    I already downloaded the SDK that is compatible with Visual C++, but still I received the same error messages.

    Code:
    c:\program files\microsoft visual studio\vc98\include\comdef.h(695) : error C2065: 'IAsyncSetup' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(710) : error C2065: 'IClassAccess' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(712) : error C2065: 'IClassAdmin' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(715) : error C2065: 'IClassRefresh' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(750) : error C2065: 'IEnumClass' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(762) : error C2065: 'IEnumPackage' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\comdef.h(1078) : error C2065: 'IXMLElementNotificationSink' : undeclared identifier
    e:\casino\golden\golden\+¦¦¦+¦server&utils\+ˇ¦÷\2008-04-02\server\gameserver_gold\debug\msado15.tlh(409) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
    c:\program files\microsoft visual studio\vc98\include\basetyps.h(155) : warning C4005: 'DECLARE_INTERFACE' : macro redefinition
            c:\program files\microsoft sdk\include\objbase.h(200) : see previous definition of 'DECLARE_INTERFACE'
    c:\program files\microsoft visual studio\vc98\include\basetyps.h(156) : warning C4005: 'DECLARE_INTERFACE_' : macro redefinition
            c:\program files\microsoft sdk\include\objbase.h(201) : see previous definition of 'DECLARE_INTERFACE_'
    Any ideas why I'm having this error? comdef.h is built in to Visual C++ and I don't remember in anyway modifying it. Are there any files that I need to add etc..?

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Undeclared identifier in header files

    Did you register the PSDK directories with Visual Studio?
    Also have a look at this thread.
    Victor Nijegorodov

  12. #12
    Join Date
    Apr 2009
    Posts
    8

    Re: Undeclared identifier in header files

    Quote Originally Posted by VictorN View Post
    Did you register the PSDK directories with Visual Studio?
    Also have a look at this thread.
    If you meant If I add the include and lib directories in my Visual C++ Directories, then yes.

    I read the problem regarding with WMI from the link that you gave, but I don't have $(VCInstallDir)PlatformSDK\include in my include directories. I only have the basic include folders and the SDK which I just downloaded and all the include files are in the same directories I don't have windows\v6.0\include folder too.
    Attached Images Attached Images  

  13. #13
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Undeclared identifier in header files

    Your "include directories" order is wrong!
    The "Microsoft SDK" must be above all the others!
    See the example:
    Attached Images Attached Images  
    Victor Nijegorodov

  14. #14
    Join Date
    Apr 2009
    Posts
    8

    Re: Undeclared identifier in header files (RESOLVED)

    Quote Originally Posted by VictorN View Post
    Your "include directories" order is wrong!
    The "Microsoft SDK" must be above all the others!
    See the example:
    Yes changing the order seems to solve the problem

    Thanks
    Last edited by Dennis_R; April 28th, 2009 at 07:16 AM.

  15. #15
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Undeclared identifier in header files

    You are welcome!
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center