gpt4 book ai didi

c++ - "fatal error: cg_config.h: No such file or directory"尝试使用 make 命令时出错

转载 作者:行者123 更新时间:2023-12-04 19:35:43 27 4
gpt4 key购买 nike

之前的stackoverflow线程位于here .我的问题发生了很大变化,以至于我认为应该创建一个新线程。我正在使用 CentOS8
我正在安装 a tool called wave-gui并且度过了一段真正的艰难时期(正如您从最后一个线程中看到的那样)。我当前的问题是当我使用 make 命令时找不到名为 cg_config.h 的文件(我也收到错误 1 ​​和 2)。让我走到这一步的所有故障排除步骤都位于前面的 thread 中。 .
我已经复制粘贴了下面 make 命令的输出,以及下面输出中提到的“主”目录的内容。

-- Creating program 'wave-gui' with sources:
-- main.cpp
-- app.cpp
-- core.cpp
-- ui.cpp
-- data.cpp
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.11)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/ellingtonj/wave-gui
Scanning dependencies of target wave-gui
[ 16%] Building CXX object CMakeFiles/wave-gui.dir/main.o
/home/ellingtonj/wave-gui/main/main.cpp:10:10: fatal error: cg_config.h: No such file or directory
#include "cg_config.h"
^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/wave-gui.dir/build.make:63: CMakeFiles/wave-gui.dir/main.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/wave-gui.dir/all] Error 2
make: *** [makefile:130: all] Error 2
app.cpp  CMakeLists.txt  core.h    data.h    ui.cpp
app.h core.cpp data.cpp main.cpp ui.h
编辑1:从工具中完全删除目录并重新克隆它并运行这些步骤。出现新错误。这次它找不到 SDL2。 (耶进步!)
mkdir -p build && cd build && cmake .. && make
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is GNU 8.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.4.2")
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindSDL2.cmake:173 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:16 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/ellingtonj/wave-gui/build/CMakeFiles/CMakeOutput.log".
See also "/home/ellingtonj/wave-gui/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:2: all] Error 1
SDL2 网站说只需使用“sudo yum install SDL2”。当我使用此命令时,我得到以下输出:
Last metadata expiration check: 1:25:41 ago on Mon 26 Oct 2020 09:54:58 AM EDT.
No match for argument: SDL2
Error: Unable to find a match: SDL2
使用相同的命令,但使用 SDL2-devel 会得到类似的输出。
我使用了“yum search SDL2”并得到了这个输出:
Last metadata expiration check: 1:26:51 ago on Mon 26 Oct 2020 09:51:55 AM EDT.
========================================= Summary Matched: SDL2 =========================================
baresip-sdl.x86_64 : SDL2 video output driver for baresip
[ellingtonj@localhost ~]$ sudo yum install SDL2-devel
Last metadata expiration check: 1:24:08 ago on Mon 26 Oct 2020 09:54:58 AM EDT.
No match for argument: SDL2-devel
Error: Unable to find a match: SDL2-devel
[ellingtonj@localhost ~]$ yum search SDL2
Last metadata expiration check: 1:28:11 ago on Mon 26 Oct 2020 09:51:55 AM EDT.
========================================= Summary Matched: SDL2 =========================================
baresip-sdl.x86_64 : SDL2 video output driver for baresip
然后我尝试了“sudo yum install baresip-sdl.x86_64”,它给了我这个输出:
Last metadata expiration check: 1:25:25 ago on Mon 26 Oct 2020 09:54:58 AM EDT.
Error:
Problem: conflicting requests
- nothing provides libSDL2-2.0.so.0()(64bit) needed by baresip-sdl-1.0.0-1.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
只是为了好玩,我输入“sudo yum install libSDL-2.0.so.0.so.0”并得到另一个“参数不匹配”
编辑 2:我听从了 yfelion 的建议,安装了 sdl2 glfw3 和 fftw。我现在收到此错误:
mkdir -p build && cd build && cmake .. && make
-- Checking for one of the modules 'glfw3'
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:640 (message):
None of the required 'glfw3' found
Call Stack (most recent call first):
CMakeLists.txt:17 (pkg_search_module)


-- FFTW support enabled.
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindOpenGL.cmake:395 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
external/imgui/CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/ellingtonj/wave-gui/build/CMakeFiles/CMakeOutput.log".
See also "/home/ellingtonj/wave-gui/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:2: all] Error 1
我现在正在考虑安装 OpenGL,但正如在上一个线程中所指出的那样,我现在正处于我的头上。我还补充说(在几个人的要求下)我正在使用 CentOS8。
编辑 3:我以为我已经安装了 glfw3,但是在安装 OpenGL 之后我得到了这个错误:
mkdir -p build && cd build && cmake .. && make
-- Checking for one of the modules 'glfw3'
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:640 (message):
None of the required 'glfw3' found
Call Stack (most recent call first):
CMakeLists.txt:17 (pkg_search_module)


-- FFTW support enabled.
CMake Warning (dev) at /usr/share/cmake/Modules/FindOpenGL.cmake:270 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.

FindOpenGL found both a legacy GL library:

OPENGL_gl_LIBRARY: /usr/lib64/libGL.so

and GLVND libraries for OpenGL and GLX:

OPENGL_opengl_LIBRARY: /usr/lib64/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib64/libGLX.so

OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
external/imgui/CMakeLists.txt:4 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Checking for one of the modules 'glfw3'
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:640 (message):
None of the required 'glfw3' found
Call Stack (most recent call first):
external/imgui/CMakeLists.txt:12 (pkg_search_module)


-- Creating program 'wave-gui' with sources:
-- main.cpp
-- app.cpp
-- core.cpp
-- ui.cpp
-- data.cpp
-- Configuring incomplete, errors occurred!
See also "/home/ellingtonj/wave-gui/build/CMakeFiles/CMakeOutput.log".
See also "/home/ellingtonj/wave-gui/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:2: all] Error 1
当我使用命令“sudo yum install glfw”时,我得到以下输出:
Last metadata expiration check: 0:07:49 ago on Mon 26 Oct 2020 12:24:38 PM EDT.
Package glfw-1:3.3-2.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

编辑 4:安装 glfw-devel 并尝试再次运行 make 命令。这次它比以往任何时候都更进一步(再次!进步!!)。虽然仍然出现错误。
mkdir -p build && cd build && cmake .. && make
-- Checking for one of the modules 'glfw3'
-- FFTW support enabled.
CMake Warning (dev) at /usr/share/cmake/Modules/FindOpenGL.cmake:270 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.

FindOpenGL found both a legacy GL library:

OPENGL_gl_LIBRARY: /usr/lib64/libGL.so

and GLVND libraries for OpenGL and GLX:

OPENGL_opengl_LIBRARY: /usr/lib64/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib64/libGLX.so

OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
external/imgui/CMakeLists.txt:4 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Creating program 'wave-gui' with sources:
-- main.cpp
-- app.cpp
-- core.cpp
-- ui.cpp
-- data.cpp
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ellingtonj/wave-gui/build
make[1]: Entering directory '/home/ellingtonj/wave-gui/build'
make[2]: Entering directory '/home/ellingtonj/wave-gui/build'
make[3]: Entering directory '/home/ellingtonj/wave-gui/build'
Scanning dependencies of target cg_core
make[3]: Leaving directory '/home/ellingtonj/wave-gui/build'
make[3]: Entering directory '/home/ellingtonj/wave-gui/build'
[ 4%] Building CXX object src/CMakeFiles/cg_core.dir/cg_config.cpp.o
[ 8%] Building CXX object src/CMakeFiles/cg_core.dir/cg_logger.cpp.o
[ 12%] Building CXX object src/CMakeFiles/cg_core.dir/cg_glfw3.cpp.o
[ 16%] Building CXX object src/CMakeFiles/cg_core.dir/cg_keyboard.cpp.o
[ 20%] Building CXX object src/CMakeFiles/cg_core.dir/cg_mouse.cpp.o
[ 25%] Building CXX object src/CMakeFiles/cg_core.dir/cg_timer.cpp.o
[ 29%] Building CXX object src/CMakeFiles/cg_core.dir/cg_window.cpp.o
[ 33%] Building CXX object src/CMakeFiles/cg_core.dir/cg_window2d.cpp.o
[ 37%] Linking CXX static library libcg_core.a
make[3]: Leaving directory '/home/ellingtonj/wave-gui/build'
[ 37%] Built target cg_core
make[3]: Entering directory '/home/ellingtonj/wave-gui/build'
Scanning dependencies of target ImGui
make[3]: Leaving directory '/home/ellingtonj/wave-gui/build'
make[3]: Entering directory '/home/ellingtonj/wave-gui/build'
[ 41%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/imgui.cpp.o
[ 45%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/imgui_demo.cpp.o
[ 50%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/imgui_draw.cpp.o
[ 54%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/imgui_user.cpp.o
[ 58%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/imgui_widgets.cpp.o
[ 62%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/examples/imgui_impl_glfw.cpp.o
[ 66%] Building CXX object external/imgui/CMakeFiles/ImGui.dir/examples/imgui_impl_opengl3.cpp.o
[ 70%] Building C object external/imgui/CMakeFiles/ImGui.dir/examples/libs/gl3w/GL/gl3w.c.o
[ 75%] Linking CXX shared library libImGui.so
/usr/bin/ld: cannot find -lXrandr
/usr/bin/ld: cannot find -lXi
/usr/bin/ld: cannot find -lXinerama
/usr/bin/ld: cannot find -lXxf86vm
/usr/bin/ld: cannot find -lXcursor
collect2: error: ld returned 1 exit status
make[3]: *** [external/imgui/CMakeFiles/ImGui.dir/build.make:191: external/imgui/libImGui.so] Error 1
make[3]: Leaving directory '/home/ellingtonj/wave-gui/build'
make[2]: *** [CMakeFiles/Makefile2:159: external/imgui/CMakeFiles/ImGui.dir/all] Error 2
make[2]: Leaving directory '/home/ellingtonj/wave-gui/build'
make[1]: *** [Makefile:130: all] Error 2
make[1]: Leaving directory '/home/ellingtonj/wave-gui/build'
make: *** [Makefile:2: all] Error 2
这看起来是 IMGui 的问题。特别是 -lX----- 东西。我将尝试重新安装 ImGui 看看是否有帮助。也可能重新启动VM。只是看看这是否能解决任何问题。可能不会,但尝试一下也无妨。
也许路径变量或其他东西无法访问它?

最佳答案

在 xubuntu 18.04 上,为了构建这个项目,我必须安装:
libsdl2-dev libglfw3-dev libfftw3-dev。
要在 Centos 7 中安装它们(您在上一个线程中提到了 centos):

https://centos.pkgs.org/7/epel-x86_64/SDL2-2.0.10-1.el7.x86_64.rpm.html  

https://centos.pkgs.org/7/epel-x86_64/SDL2-devel-2.0.10-1.el7.x86_64.rpm.html

https://centos.pkgs.org/7/epel-x86_64/glfw-3.2.1-2.el7.x86_64.rpm.html

https://centos.pkgs.org/7/epel-x86_64/glfw-devel-3.2.1-2.el7.x86_64.rpm.html

https://centos.pkgs.org/7/centos-x86_64/fftw-devel-3.3.3-8.el7.x86_64.rpm.html
启用@Rup 提到的EPEL 存储库将是一个好主意。

关于c++ - "fatal error: cg_config.h: No such file or directory"尝试使用 make 命令时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64539139/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com