C++ ld找不到glfw3

C++ ld找不到glfw3,c++,linux,ubuntu,opengl,glfw,C++,Linux,Ubuntu,Opengl,Glfw,我正试图建立在Ubuntu 16.04上。首先,我必须运行cmake,这似乎是可行的,然后我必须运行make来编译 我相信我已经安装了glfw3和Mesa OpenGL软件包。当我执行cmake时(在安装libglfw3和libglfw3 dev之后),我会收到一条消息,表明已找到OpenGL和GLFW3: -- Found OpenGL: /usr/lib/libGL.so -- Checking for module 'glfw3' -- Found glfw3, version

我正试图建立在Ubuntu 16.04上。首先,我必须运行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
libglfw.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libglfw.so.3
然而,当我输入
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”

这表明:

-lglfw
libglfw.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libglfw.so.3
相反,
sudoldconfig-p | grep“glfw3”
不返回任何内容


我下载的这个cmake文件是否设置错误,无法告诉链接器何时应该告诉它
-lglfw3
?或者我的库路径没有正确定义?

错误/过时
CMakeLists.txt

是:

应该是:

set(COMMON_LIBS sb7 glfw X11 Xrandr Xinerama Xi Xxf86vm Xcursor GL rt dl)
                        ^ no 3
更好的是,他们可能应该使用