gpt4 book ai didi

gcc -D 选项没有做我认为的那样

转载 作者:行者123 更新时间:2023-12-04 15:02:38 24 4
gpt4 key购买 nike

我正在尝试在项目中使用 AsmJit。这是我使用的makefile:

CC = g++
CFLAGS = -D ASMJIT_API -I dep/

test: src/main.cpp
$(CC) $(CFLAGS) src/main.cpp -o test.exe

尝试此操作时遇到编译器错误,因此我取消了对行 #define ASMJIT_API 的注释。从 dep/AsmJit/Config.h,并从 makefile 中删除 -D 开关,并且所有内容都被干净地编译。我正在使用 gcc 4.5.3。有任何想法吗?

谢谢。

编辑:编译器错误
g++ -DASMJIT_API -Idep/ src/main.cpp -o test.exe
In file included from dep/AsmJit/Assembler.h:31:0,
from src/main.cpp:1:
dep/AsmJit/Build.h:274:1: error: expected unqualified-id before numeric constant
In file included from dep/AsmJit/AssemblerX86X64.h:36:0,
from dep/AsmJit/Assembler.h:51,
from src/main.cpp:1:
dep/AsmJit/Defs.h:408:1: error: expected unqualified-id before numeric constant
In file included from dep/AsmJit/DefsX86X64.h:36:0,
from dep/AsmJit/Defs.h:423,
from dep/AsmJit/AssemblerX86X64.h:36,
from dep/AsmJit/Assembler.h:51,
from src/main.cpp:1:
dep/AsmJit/Util.h:412:8: error: expected identifier before numeric constant
dep/AsmJit/Util.h:412:8: error: expected unqualified-id before numeric constant
src/main.cpp:6:1: error: expected ‘}’ at end of input
makefile:5: recipe for target `test' failed
make: *** [test] Error 1

最佳答案

#define ASMJIT_API之间有区别和 -DASMJIT_API .
#define语句定义 ASMJIT_API无,而 the -D flag defines the preprocessor constant as 1 .

使用 -D标志,build.h 的第 274 行扩展为

1 void assertionFailure(const char* file, int line, const char* exp);

导致编译器错误。

关于gcc -D 选项没有做我认为的那样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9542642/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com