Thread: Using extern C and mfc?

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    27

    Using extern C and mfc?

    When trying to compile an mfc application with an include c header using the extern "C" directive I get the following error:

    fatal error C1010: unexpected end of file while looking for precompiled header directive

    When not compiling as an mfc application it works fine, but I want to add a gui to my old mixed c and cpp application.

    Regards,
    /S

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    this really belongs in the windows section, but anyway, if you go to your project properties, and browse through the options, there is one that says something like "do not use precompiled headers". You will need to do that if you are going to mix C code with your MFC app.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    you have to turn off precompiled headers for *.c files. If you are using VC++ 6.0 select menu item Projects --> Settings, hit the C++ tab, select "Precompiled Headers" in the Category combo box, On the left-most side of the Project Settings dialog box, expand the project tree view and select the *.c file(s). Then select the "Not using precompiled headers" radio button on the right side of the dialog box. Finally, select the Ok button.

    If you are using .NET 2003 compiler, you also turn off precompiled headers similar to, but not exactly like, the above description for VC++ 6.0. I don't have that compiler, but you should be able to figure it out on your own.

Popular pages Recent additions subscribe to a feed