错误:collect2:错误:ld返回1退出状态CS106B Stanford Qt Creator 我是C++新手,我刚开始斯坦福大学的CS106B课程,有网上资源。

错误:collect2:错误:ld返回1退出状态CS106B Stanford Qt Creator 我是C++新手,我刚开始斯坦福大学的CS106B课程,有网上资源。,c++,ubuntu,qt-creator,C++,Ubuntu,Qt Creator,我目前正在使用Ubuntu,当我尝试在QtCreator中构建示例项目时,我遇到了以下问题 error: collect2: error: ld returned 1 exit status 在编译输出中,我得到以下结果: /usr/bin/x86_64-linux-gnu-ld: cannot find -lGL Makefile:426: recipe for target 'sample-project' failed collect2: error: ld returned 1 exi

我目前正在使用Ubuntu,当我尝试在QtCreator中构建示例项目时,我遇到了以下问题

error: collect2: error: ld returned 1 exit status
在编译输出中,我得到以下结果:

/usr/bin/x86_64-linux-gnu-ld: cannot find -lGL
Makefile:426: recipe for target 'sample-project' failed
collect2: error: ld returned 1 exit status
make: *** [sample-project] Error 1
14:29:38: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project sample-project (kit: Desktop Qt 5.11.1 GCC 64bit)
When executing step "Make"

非常感谢您的帮助

我也遇到了同样的问题。试试这个:

  • 开放式终端
  • input cmd:sudo apt get安装构建基本libgl1 mesa dev
  • 按“y”
这解决了我的问题


致以最诚挚的问候。

示例项目位置位于上面的链接
/usr/bin/x86_64-linux-gnu-ld:找不到-lGL
,这表明您的opengl库存在问题。这可能会帮助您: