Problem using LLVM 2.6

Discussion in 'Mac Programming' started by m85, Jan 23, 2010.

  1. m85 macrumors newbie

    Apr 8, 2008
    Here' what I did:

    • Downloaded the llvm 2.6 trunk from subversion using "svn co llvm"
    • Configured with options "./configure --enable-optimized --enable-targets=x86_64"
    • Compiled it with "make -j2"
    • Installed it with "sudo make install"

    Now I can't compile the following source:

    // main.cpp
    #include "llvm/LLVMContext.h"
    #include "llvm/Module.h"
    #include "llvm/Analysis/Verifier.h"
    #include "llvm/Support/IRBuilder.h"
    int main(void)
    	return 0;
    The error message I get is:
    # error "Must #define __STDC_LIMIT_MACROS before #including System/DataTypes.h"​

    I'm using an Intel Core 2 Duo Mac mini running Snow Leopard 10.6.2 and Xcode 3.2.1. I've tried including all the standard c++ library headers and making sure the search paths are correct. All my attempts have failed and I don't know what I'm doing wrong. Any help will be highly appreciated.
  2. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    Have you tried including limits.h?

    Before the LLVM includes that is.

    Edit: I'm just building it myself now to have a little play around with this as you got me interested.
  3. m85 thread starter macrumors newbie

    Apr 8, 2008
    I've tried both <limits.h> and <climits> to no avail.
  4. lloyddean macrumors 6502a

    May 10, 2009
    Des Moines, WA
    If compiling from the command line add:

    to the g++ invocation.

    Alternately if being used from within Xcode add it to the project level settings. Search for 'GCC_PREPROCESSOR_DEFINITIONS' and add to it to the list of predefined macros:

  5. m85 thread starter macrumors newbie

    Apr 8, 2008
    Thank you. I also had to add __STDC_CONSTANT_MACROS=1 but it now compiles without any errors.

Share This Page