我目前正在开发一个需要 C++20 (g++ v11) 功能和 CMake 的项目。项目树类似于以下项目:
- Top level
- src
- IO
- IO.cpp
- CMakeLists.txt
- main.cpp
- CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)
CMake 编译 IO 模块没有任何问题,但它通过以下方式生成 gcm.cache 文件夹:
- build
- Some other CMake files and folders
- bin
- lib
- src
- IO
- gcm.cache
- IO.gcm
Run Code Online (Sandbox Code Playgroud)
因此,g++ 找不到 gcm.cache 文件夹并给出以下错误:
IO: error: failed to read compiled module: No such file or directory
IO: note: compiled module file is 'gcm.cache/IO.gcm'
IO: note: imports must be built before being …Run Code Online (Sandbox Code Playgroud)