[LLVMdev] The first two lines of llvm tutorial don't compile.

Mike Stump mrs at apple.com
Mon Jun 2 10:04:12 PDT 2008

On Jun 2, 2008, at 9:43 AM, Hendrik Boom wrote:
> I took the first two lines of the sample program in the tutorial:

> /usr/include/llvm/Support/DataTypes.h:38:3: error: #error "Must  
> #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"

The #error is unfortunate.  It all comes about because the C standards  
committee tried to define C++ and they got it wrong.  Then this wrong  
concept was burned into stdint.h, for poor project folks to deal with.

 From the header itself:

// Note that this header's correct operation depends on  
// being defined.  We would define it here, but in order to prevent  
Bad Things
// happening when system headers or C++ STL headers include stdint.h  
// we define it here, we define it on the g++ command line (in  
#if !defined(__STDC_LIMIT_MACROS)
# error "Must #define __STDC_LIMIT_MACROS before #including Support/ 

So, for now, it looks like you have to define the on the command  
line.  :-(

This code is bogus however, working stdint.h files don't need this  
defined and checking it like this is wrong.

More information about the llvm-dev mailing list