ld fails to find glfw3
ld fails to find glfw3
我正在尝试在 Ubuntu 16.04 上构建 OpenGL 超级圣经第 7 版代码示例。首先我必须运行 cmake,这似乎有效,然后我必须运行 make 进行编译。
我相信我已经安装了glfw3和Mesa OpenGL软件包。当我执行 cmake 时(安装 libglfw3 和 libglfw3-dev 后(,我收到已找到 OpenGL 和 GLFW3 的消息:
-- Found OpenGL: /usr/lib/libGL.so
-- Checking for module 'glfw3'
-- Found glfw3, version 3.1.2
但是当我在 cmake 完成后执行 make 时,我收到此错误:
.../sb7code-master/src/sb7/sb7object.cpp: In member function ‘void sb7::object::render_sub_object(unsigned int, unsigned int, unsigned int)’:
.../sb7code-master/src/sb7/sb7object.cpp:212:77: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
(void*)sub_object[object_index].first,
^
[ 3%] Building CXX object CMakeFiles/sb7.dir/src/sb7/sb7shader.cpp.o
[ 4%] Building CXX object CMakeFiles/sb7.dir/src/sb7/sb7textoverlay.cpp.o
[ 4%] Building C object CMakeFiles/sb7.dir/src/sb7/gl3w.c.o
[ 5%] Linking CXX static library lib/libsb7.a
[ 5%] Built target sb7
Scanning dependencies of target wrapmodes
[ 6%] Building CXX object CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o
[ 7%] Linking CXX executable ../bin/wrapmodes
/usr/bin/ld: cannot find -lglfw3
collect2: error: ld returned 1 exit status
CMakeFiles/wrapmodes.dir/build.make:95: recipe for target '../bin/wrapmodes' failed
make[2]: *** [../bin/wrapmodes] Error 1
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/wrapmodes.dir/all' failed
make[1]: *** [CMakeFiles/wrapmodes.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
所以我试图看看是否安装了 glfw3。我是 Linux 新手,所以我在网上找到了这些命令:
sudo pkg-config --libs glfw3
吐出:
-lglfw
而当我进入sudo pkg-config --libs glfw
末尾没有 3 时,我得到:
Package glfw was not found in the pkg-config search path.
Perhaps you should add the directory containing `glfw.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glfw' found
我试过了:sudo ldconfig -p | grep "glfw"
吐出:
libglfw.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libglfw.so.3
相反,sudo ldconfig -p | grep "glfw3"
什么也不返回。
我下载的这个cmake文件是否设置不正确,以告诉链接器-lglfw3
,当它应该告诉它-lglfw
? 还是我的库路径未正确定义?
错误/过时的CMakeLists.txt
.
CMakeLists.txt
的第 28 行是:
set(COMMON_LIBS sb7 glfw3 X11 Xrandr Xinerama Xi Xxf86vm Xcursor GL rt dl)
^ wat
应该是:
set(COMMON_LIBS sb7 glfw X11 Xrandr Xinerama Xi Xxf86vm Xcursor GL rt dl)
^ no 3
更好的是,他们可能应该使用find_package()
来查找GLFW。
相关文章:
- std::map<struct,struct>::find 找不到匹配项,但是如果我循环通过 begin() 到 end(),我在那里看到匹配项
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- 使用.find函数在c++中查找字符和另一个字符之间的大小
- 在 QVector<std::unique_ptr 上使用 std::find<Type>>
- 错误"Could not find Boost"(缺少:上下文标头)
- /usr/bin/ld: cannot find -lc++
- std::find,返回所有找到的值的替代方法,而不仅仅是存在重复的向量的第一个值
- 使用 find 解析文件会给出不同文件的奇怪结果
- 在 ifcondition al中 find() C++ STL 中的 == a.end() 有什么用?
- Cannot find -lglad
- "Cannot find -l<directory>"错误 - CMake
- 为什么在向量上使用 std::find() 时会出现错误?
- 为什么映射插入和 map.find() 的单次迭代比插入和 map.find() 的两次单独迭代慢得多
- C++ find() 在存储为变量时返回不同的值
- set::find 查找不存在的元素
- 使用 std::find 时没有匹配的函数调用错误
- 在先前调用 string::find 后添加内存分配和内存集会导致它返回 npos.为什么?
- Windows cannot find MinGW
- find() stl in vector in c++
- ld fails to find glfw3