How to include header file through makefile

前端 未结 2 439
忘了有多久
忘了有多久 2020-12-19 10:25

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

相关标签:
2条回答
  • 2020-12-19 10:36

    In your compile command, you can use the -include option:

    gcc -o main -include hello.h main.cpp 
    
    0 讨论(0)
  • 2020-12-19 10:44

    something like this maybe? include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

    0 讨论(0)
提交回复
热议问题