The __CPLUSPLUS macro

Discussion in 'Mac Programming' started by mainstreetmark, Mar 29, 2011.

  1. mainstreetmark macrumors 68020

    mainstreetmark

    Joined:
    May 7, 2003
    Location:
    Saint Augustine, FL
    #1
    I'm not very good at C any more, but I do have a project i need to compile on OSX. I'm using XCode4, and have the thing compiling fine in Linux, with gcc. The project uses a third party library, and that library is complaining that i'm not using C++, evidently. Here's the error it's throwing.

    #ifndef __cplusplus
    # error Must use C++ to compile this module!
    #endif

    It's also erroring on some C++ specific terms, such as 'class'.

    The file has a .hpp extension. I created the project as a C++ project.

    Can anyone point me in the right direction?
     
  2. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #2
    Are you compiling with g++ or gcc? Is the c source in a .c or a .cpp file?
     
  3. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #3
    In your project, click on the .hpp file, Command-I (Info), click on the "General" tab. Then check the file type.
     

Share This Page