我目前正试图从Windows10迁移到Linux(Pop!_OS),但我无法让我的C++项目在后者上正确编译和运行.我的C++项目是使用Visual Studio创建的,我还在其中指定了解决方案属性中的包含文件夹、库文件夹、应该链接的内容等.我现在想改用Neovim编写代码,而不是使用Visual Studio(或Visual Studio代码),并try 通过G++编译它.我很快注意到我的包含文件无法识别,所以我try 使用CMake并创建了一个CMakeLists.txt.我两个都试过了
INCLUDE_DIRECTORIES()
和
TARGET_INCLUDE_DIRECTORIES()
但无论我输入什么路径,我包含的文件都无法识别.即使我使用了导致第一个错误的特定包含文件的路径,它仍然无法识别.
My goal would be that I can specify an include folder 和 a library folder, so that I can just add files 和 folders in these 和 that the new files 和 folders automatically get recognized when compiling (i.e I would not have to edit the CMakeLists.txt in the future). Is that even possible with CMake 和 if yes, does anyone know where i can find further information about that or does anyone have a CMakeLists.txt file that does this? If no, would I have to specify each 和 every file 和 folder in the CMakeLists.txt file 和 do the same for every new include 和 library?
项目 struct :
Overall folder
\- build
\- include
---> includeFolder1
---> includeFolder2
---> ...
\- libs
---> library1.lib
---> library2.lib
---> ...
\- src
--> main.cpp
--> other .cpp's 和 .h's
--> other folders with .cpp's 和 .h's
I've tried compiling with G++ 和 CMake, but both did not work, no matter what I specified as the include 和 library paths.