柯南包装标头文件未找到CMAKE
我已经使用Conan和Cmake建立了一个C ++项目。我执行了以下命令:
conan install . --install-folder cmake-build-release --build=missing
cmake . -DCMAKE_TOOLCHAIN_FILE=cmake-build-release/conan_toolchain.cmake
cmake --build .
构建我的main.cpp时,我会收到以下错误:
/mnt/f/Projekte/rmldemo/src/main.cpp:1:24: fatal error: RmlUi/Core.h: No such file or directory
^
compilation terminated.
CMakeFiles/rmlui_project.dir/build.make:75: recipe for target 'CMakeFiles/rmlui_project.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/rmlui_project.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/rmlui_project.dir/all' failed
make[1]: *** [CMakeFiles/rmlui_project.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
我的cmakelists.txt:
cmake_minimum_required(VERSION 3.15)
project(rmlui_project CXX)
find_package(rmlui)
add_executable(${PROJECT_NAME} src/main.cpp)
# Use the global target
target_link_libraries(${PROJECT_NAME} rmlui::rmlui)
我的conanfile.txt:
[requires]
rmlui/4.3
[generators]
CMakeDeps
CMakeToolchain
我的main.cpp:
#include <RmlUi/Core.h>
#include <RmlUi/Core/StreamMemory.h>
#include <RmlUi/Core/TransformPrimitive.h>
#include <RmlUi/Debugger.h>
#include "Backends/RmlUi_Backend.h"
#include "Shell/Shell.h"
I have set up a C++ project using Conan and Cmake. I have executed the following commands:
conan install . --install-folder cmake-build-release --build=missing
cmake . -DCMAKE_TOOLCHAIN_FILE=cmake-build-release/conan_toolchain.cmake
cmake --build .
When building my main.cpp I get the following error:
/mnt/f/Projekte/rmldemo/src/main.cpp:1:24: fatal error: RmlUi/Core.h: No such file or directory
^
compilation terminated.
CMakeFiles/rmlui_project.dir/build.make:75: recipe for target 'CMakeFiles/rmlui_project.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/rmlui_project.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/rmlui_project.dir/all' failed
make[1]: *** [CMakeFiles/rmlui_project.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
My CmakeLists.txt:
cmake_minimum_required(VERSION 3.15)
project(rmlui_project CXX)
find_package(rmlui)
add_executable(${PROJECT_NAME} src/main.cpp)
# Use the global target
target_link_libraries(${PROJECT_NAME} rmlui::rmlui)
My conanfile.txt:
[requires]
rmlui/4.3
[generators]
CMakeDeps
CMakeToolchain
My main.cpp:
#include <RmlUi/Core.h>
#include <RmlUi/Core/StreamMemory.h>
#include <RmlUi/Core/TransformPrimitive.h>
#include <RmlUi/Debugger.h>
#include "Backends/RmlUi_Backend.h"
#include "Shell/Shell.h"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议将
您的
conanfile.txt
添加到的需求 - 安装文件cmake-build-release
。然后,您可以使用生成的
cmakeuserpresets.json
中定义的预设:或者,如果您不希望使用生成的预设和布局,则可以做:
I recommend adding
to your
conanfile.txt
to avoid the need for--install-folder cmake-build-release
.You can then use the presets defined in the generated
CMakeUserPresets.json
:Alternatively, if you would prefer not to use the generated presets and the layout, you can do: