在Linux上安装raylib的一个问题
我使用的是基于ubuntu的发行版Peppermint 10
所以我执行了以下命令here,在此之前一切都很顺利
(the input)
cmake -DBUILD_SHARED_LIBS=ON ..
(the output)
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Using raylib's GLFW
-- Using X11 for window creation
-- Audio Backend: miniaudio
-- Building raylib shared library
-- Generated build type: Debug
-- Compiling with the flags:
-- PLATFORM=PLATFORM_DESKTOP
-- GRAPHICS=GRAPHICS_API_OPENGL_33
-- Building examples is enabled
-- Testing if -std=c11 can be used -- compiles
-- Configuring done
CMake Error at src/CMakeLists.txt:57 (add_library):
Error evaluating generator expression:
$<TARGET_OBJECTS:glfw>
Objects of target "glfw" referenced but is not an OBJECT library.
CMake Error: CMake can not determine linker language for target: raylib
CMake Error: Cannot determine link language for target "raylib".
-- Generating done
-- Build files have been written to: /home/anas/raylib/build
我如何修复这些cmake错误?
但后来我忽略了这些,认为这是正常的,但当我尝试执行以下命令时
(the command aka the input)
make
(the output)
[ 7%] Built target glfw
make[2]: *** No rule to make target 'raylib/CMakeFiles/raylib.dir/build'. Stop.
CMakeFiles/Makefile2:87: recipe for target 'raylib/CMakeFiles/raylib.dir/all' failed
make[1]: *** [raylib/CMakeFiles/raylib.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
当我尝试 sudo make install
帮助 我还是不知道这里有什么问题 顺便说一句,我正在关注维基here
解决方案
执行此操作:
- sudo apt安装g++
- sudo apt安装cmake(应为3.11或更高版本)
- 下载到您的项目文件夹ex。‘new-Game’文件夹https://github.com/RobLoach/raylib-cpp/tree/master/projects/CMake(main.cpp,Readme.md,CMakeLists.txt)
- 然后
cd new-game && mkdir build && cd build && cmake .. && make
- 运行
./raylib-cpp-example
相关文章