none
SetupAPI -- Errors when Included

    Question

  • Hello I've just included some code from another project, that was working, and I started getting odd errors. When you click on the errors it took me to a header file that I had included.

    Well, I just assumed I had mangled some code. I decided to comment out everything relative to SetupAPI.h. Still didn't work. So, I commented out #include <SetupAPI.h>. This fixed my problem, meaning that the error is localized to that include. My other project is working and runs on the same machine and has the same include files under the linker file. The only thing that I can figure is that I am missing some configuration property hidden somewhere else. Any ideas?

    BTW, I tried the following solution found at this link (it didn't work):http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/70f88124-3207-4e65-996a-bf004c65b06c

     

    Thanks.

    Friday, September 30, 2011 3:57 PM

Answers

  • On 9/30/2011 12:51 PM, Ctank02 wrote:

    Error    1    error C2143: syntax error : missing ')' before 'constant'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2889

    My guess is, you have a macro defined somewhere above SetupApi.h, or in project properties. I'd look for a macro named DialogTitle or File or Style (or hwndParent or Win32ErrorCode, but these seem less likely to happen by accident).


    Igor Tandetnik

    • Marked as answer by Rob Pan Monday, October 10, 2011 8:14 AM
    Friday, September 30, 2011 5:02 PM
  • The program interfaces with a driver I am writing. I included the Windows.h prior to setupapi.h; unfortunately, this didn't fix the problem.

    Anyway try to use the VC++ version of include files rather than WDK. Chances are it will just work. Mixing VC++ and WDK includes should be done very carefully otherwise it gives strange results like you get.
    • Edited by Pavel A Saturday, October 01, 2011 1:25 PM
    • Marked as answer by Rob Pan Monday, October 10, 2011 8:14 AM
    Saturday, October 01, 2011 1:25 PM

All replies

  • On 9/30/2011 11:57 AM, Ctank02 wrote:

    Hello I've just included some code from another project, that was
    working, and I started getting odd errors. When you click on the
    errors it took me to a header file that I had included.

    Are you going to tell us what those errors were, or would you like to maintain the suspence a while longer? I'm on the edge of my seat with anticipation.


    Igor Tandetnik

    Friday, September 30, 2011 4:02 PM
  • Error    1    error C2143: syntax error : missing ')' before 'constant'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2889
    Error    2    error C2143: syntax error : missing ';' before 'constant'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2889
    Error    3    error C2059: syntax error : ')'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2892
    Error    4    error C2143: syntax error : missing ')' before 'constant'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2900
    Error    5    error C2143: syntax error : missing ';' before 'constant'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2900
    Error    6    error C2059: syntax error : ')'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2903

    Lines relative to the errors (which are correct):

     

    WINSETUPAPI
    UINT
    WINAPI
    SetupDeleteErrorA(
        __in HWND hwndParent,
        __in_opt PCSTR DialogTitle,
        __in PCSTR File,
        __in UINT Win32ErrorCode,
        __in DWORD Style
        );
    
    WINSETUPAPI
    UINT
    WINAPI
    SetupDeleteErrorW(
        __in HWND hwndParent,
        __in_opt PCWSTR DialogTitle,
        __in PCWSTR File,
        __in UINT Win32ErrorCode,
        __in DWORD Style
        );

    Friday, September 30, 2011 4:12 PM
  • On 9/30/2011 12:12 PM, Ctank02 wrote:

    Error    1    error C2143: syntax error : missing ')' before 'constant'    C:\WinDDK\7600.16385.1\inc\api\SetupAPI.h    2889

    Are you including windows.h before setupapi.h ? Make sure you do.

    It's also somewhat surprising that you are taking the header from DDK (driver development kit). You are not writing a driver, are you? Normally, SetupAPI.h would come from Platform SDK.


    Igor Tandetnik

    Friday, September 30, 2011 4:29 PM
  • The program interfaces with a driver I am writing. I included the Windows.h prior to setupapi.h; unfortunately, this didn't fix the problem.

    Also, I removed the property I had added that made it point to WinDDK. It nows points back at the Platform SDK.

    The errors are still identical, it just points to a different spot.

     

    Thanks.

     

    Friday, September 30, 2011 4:36 PM
  • On 9/30/2011 12:36 PM, Ctank02 wrote:

    The errors are still identical, it just points to a different spot.

    Which spot?


    Igor Tandetnik

    Friday, September 30, 2011 4:46 PM
  • Error    1    error C2143: syntax error : missing ')' before 'constant'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2889
    Error    2    error C2143: syntax error : missing ';' before 'constant'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2889
    Error    3    error C2059: syntax error : ')'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2892
    Error    4    error C2143: syntax error : missing ')' before 'constant'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2900
    Error    5    error C2143: syntax error : missing ';' before 'constant'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2900
    Error    6    error C2059: syntax error : ')'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2903
        7    IntelliSense: expected a ')'    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\setupapi.h    2889
        8    IntelliSense: expected a ')'    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\setupapi.h    2900

     

    The intellisense ones might be new, I don't think I missed them before. New spot: c:\program files (x86)\microsoft sdks\windows\v7.0a\include\setupapi.h  instead of the WinDDK path.

    Friday, September 30, 2011 4:51 PM
  • On 9/30/2011 12:51 PM, Ctank02 wrote:

    Error    1    error C2143: syntax error : missing ')' before 'constant'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\SetupAPI.h    2889

    My guess is, you have a macro defined somewhere above SetupApi.h, or in project properties. I'd look for a macro named DialogTitle or File or Style (or hwndParent or Win32ErrorCode, but these seem less likely to happen by accident).


    Igor Tandetnik

    • Marked as answer by Rob Pan Monday, October 10, 2011 8:14 AM
    Friday, September 30, 2011 5:02 PM
  • The program interfaces with a driver I am writing. I included the Windows.h prior to setupapi.h; unfortunately, this didn't fix the problem.

    Anyway try to use the VC++ version of include files rather than WDK. Chances are it will just work. Mixing VC++ and WDK includes should be done very carefully otherwise it gives strange results like you get.
    • Edited by Pavel A Saturday, October 01, 2011 1:25 PM
    • Marked as answer by Rob Pan Monday, October 10, 2011 8:14 AM
    Saturday, October 01, 2011 1:25 PM
  • The actual problem was due to something in my MFC class. I had a resource labeled File and in setupapi, there is something called File. These two conflicted and that was what was creating the error.
    Monday, October 10, 2011 11:49 AM