#error“must #define __STDC_LIMIT_MACROS before #includeing Support / DataTypes.h” [英] #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"

查看:392
本文介绍了#error“must #define __STDC_LIMIT_MACROS before #includeing Support / DataTypes.h”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图按照的教程http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/5/ (使用flex,bison和llvm)但输入行时

I have been trying to follow the tutorial at http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/5/ (using flex, bison and llvm) but when typing the line


g ++ -o parser parser.cpp tokens.cpp main.cpp

g++ -o parser parser.cpp tokens.cpp main.cpp

我收到以下错误:

In file included from /usr/local/include/llvm/Support/PointerLikeTypeTraits.h:18:0,
                 from /usr/local/include/llvm/ADT/PointerIntPair.h:17,
                 from /usr/local/include/llvm/IR/Use.h:28,
                 from /usr/local/include/llvm/IR/Value.h:17,
                 from node.h:3,
                 from parser.y:2:
/usr/local/include/llvm/Support/DataTypes.h:48:3: erreur: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
/usr/local/include/llvm/Support/DataTypes.h:52:3: erreur: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
parser.y: In function ‘void yyerror(const char*)’:
parser.y:6:58: erreur: ‘printf’ was not declared in this scope
In file included from /usr/local/include/llvm/Support/PointerLikeTypeTraits.h:18:0,
                 from /usr/local/include/llvm/ADT/PointerIntPair.h:17,
                 from /usr/local/include/llvm/IR/Use.h:28,
                 from /usr/local/include/llvm/IR/Value.h:17,
                 from node.h:3,
                 from tokens.l:3:
/usr/local/include/llvm/Support/DataTypes.h:48:3: erreur: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
/usr/local/include/llvm/Support/DataTypes.h:52:3: erreur: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
In file included from /usr/local/include/llvm/Support/PointerLikeTypeTraits.h:18:0,
                 from /usr/local/include/llvm/ADT/PointerIntPair.h:17,
                 from /usr/local/include/llvm/IR/Use.h:28,
                 from /usr/local/include/llvm/IR/Value.h:17,
                 from node.h:3,
                 from main.cpp:2:
/usr/local/include/llvm/Support/DataTypes.h:48:3: erreur: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
/usr/local/include/llvm/Support/DataTypes.h:52:3: erreur: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"

这样的帖子在互联网上,大多数的答案包括在命令行或使用gcc Makefile定义这些常量。

I have seen lots of posts like this on the internet, and most of the answers include defining these constants on the command line or by using gcc Makefile.

我不明白如何做

推荐答案

将它附加到您的命令行:

Append this to your command line:

-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS

关于 -D 命令行选项,请参阅 gcc的预处理器选项的文档

For more information about the -D command line option, refer to gcc's documentation on preprocessor options.

这篇关于#error“must #define __STDC_LIMIT_MACROS before #includeing Support / DataTypes.h”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆