linux 上安装 raylib 的问题

问题描述 投票:0回答:2

我正在使用 Peppermint 10 一个基于 ubuntu 的发行版

所以我在这里执行了以下命令,一切都很顺利,直到这


(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

帮助 我还是不知道这里有什么问题 顺便说一句,我正在关注维基这里

c++ c cmake ubuntu-16.04 raylib
2个回答
2
投票

这样做:

  1. sudo apt install g++
  2. sudo apt install cmake(应该是3.11或更高版本)
  3. 下载到您的项目文件夹例如。 “new-game”文件夹中的这三个文件来自https://github.com/RobLoach/raylib-cpp/tree/master/projects/CMake(main.cpp、README.md、CMakeLists.txt)
  4. 然后
    cd new-game && mkdir build && cd build && cmake .. && make
  5. 奔跑
    ./raylib-cpp-example

0
投票

当我尝试在 Ubuntu 18.04 上构建 raylib 时,我遇到了同样的问题。 20.04和22.04没有这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.