I know that there is a flag that can be used in makefile to include a header file in all the files which are being compiled, just like there is a -D flag to include a define. What flag is exactly for including header files. I don't remember know.
我知道有一个标志可以在makefile中使用,在所有正在编译的文件中包含一个头文件,就像有一个-D标志来包含一个define。包含头文件的确切标志。我不记得了。
2 个解决方案
#1
8
In your compile command, you can use the -include
option:
在编译命令中,可以使用-include选项:
gcc -o main -include hello.h main.cpp
#2
0
something like this maybe? include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
这样的事可能吗? include_directories($ {CMAKE_CURRENT_SOURCE_DIR} /包括)
#1
8
In your compile command, you can use the -include
option:
在编译命令中,可以使用-include选项:
gcc -o main -include hello.h main.cpp
#2
0
something like this maybe? include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
这样的事可能吗? include_directories($ {CMAKE_CURRENT_SOURCE_DIR} /包括)