Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道可以在 makefile 中使用一个标志来在所有正在编译的文件中包含一个头文件,就像有一个 -D 标志来包含一个定义一样。包含头文件的确切标志是什么。我不记得知道。
在您的编译命令中,您可以使用以下-include选项:
-include
gcc -o main -include hello.h main.cpp
像这样的东西?包含目录(${CMAKE_CURRENT_SOURCE_DIR}/include)