excpt.h error

I’m working on a DLL that’ll export some functions. I tried this with File->New->Projects->Win32 Dynamic-Link Library, and then selected the radio button 'A DLL that exports some symbols'. When I try to compile the project (as it is with the default code inserted by VC++), I get these errors:

 d:\program files\microsoft visual studio\vc98\include\excpt.h(36) : error C2144: syntax error : missing ';' before type 'int'
d:\program files\microsoft visual studio\vc98\include\excpt.h(36) : error C2501: 'i' : missing storage-class or type specifiers
d:\program files\microsoft visual studio\vc98\include\excpt.h(36) : fatal error C1004: unexpected end of file found

Apparently, the offending line for all the above errors is 'extern "C" {' ( !)

Next I tried this with 'An empty DLL project', used '__declspec(dllexport)' for the functions; the errors persist.

I just tried commenting out the code line by line, figures that the compilation goes through the moment I comment out '#include<windows.h>'! I need that header file, however.

I trawled on the Web for more info on doing away with these errors, but that didn't help. What am I missing here

 Thanks in advance.



Answer this question

excpt.h error

  • Patrick B

    Just a tip!

    I had the same problems, and due to some tiping i destryoed some MFC header files. I took me 5 hours to find it. After that I always the the include files or source files in the folders for VS to read only.
    Or I restrict the access to the user who is programming to just readonly to the VS folders.

  • yann sugere

    I took your suggestion of checking my header files (windows.h and excpt.h) against those on my colleague's system and you're absolutely right! I found an unsuspecting 'i' on the first line of windows.h! I've no idea what that is and how it got there, but I deleted it and built my dll's and voila, got it this time round!
    Thanks, thanks, thanks. Big Smile  


  • subansuba

    Is it possible that in any code before you #include excpt.h is an error
    In example a missing ; behind the class definition or similar
    Or is there any macro definition to the keyword extern


  • si downes

    I'm afraid not.

    1) In fact, VC++ includes windows.h and not excpt.h on selecting 'A DLL that exports some symbols' and there are just some #define's above the inclusion. The line just above it is:
    // Insert your headers here
    #define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers

    2) In the 'Empty DLL Project' that I selected, I'd moved #include<windows.h> to the first line, but that too didn't work.

    In both of the above cases, the errors are exactly the same. Here's the code snippet from excpt.h
    /*1*/  #ifdef  __cplusplus
    /*2*/  extern "C" {
    /*3*/ #endif
    The compiler flags line 2 as an error.

  • Willeem

    Use /EP or /P to check what the preprocessor creates.
    Can it be that one of your windows include files is destroyed or manipulated

  • excpt.h error