Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

m85

macrumors newbie
Original poster
Apr 8, 2008
8
0
Here' what I did:

  • Downloaded the llvm 2.6 trunk from subversion using "svn co http://llvm.org/svn/llvm-project/llvm/trunk 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:

Code:
//
// 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.
 
I've tried both <limits.h> and <climits> to no avail.
 
If compiling from the command line add:

Code:
-D __STDC_LIMIT_MACROS=1
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:

Code:
__STDC_LIMIT_MACROS=1
 
Thank you. I also had to add __STDC_CONSTANT_MACROS=1 but it now compiles without any errors.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.