glfw3缺少特定于glfw3的引用
glfw3 specific refrences missing with glfw3
当我尝试在上编译glfw3的示例代码时http://www.glfw.org/documentation.html(复制/粘贴到测试编译),我得到了以下错误:
/tmp/ccCdEKoi.o: In function main':
example.cpp:(.text+0x38): undefined reference toglfwCreateWindow'
example.cpp:(.text+0x5b): undefined reference to glfwMakeContextCurrent'
example.cpp:(.text+0x7a): undefined reference toglfwWindowShouldClose'
collect2: error: ld returned 1 exit status
我使用g++ example.cpp -o example -lGL -lglfw
进行编译,当我安装最新的glfw 3.0.2时,它安装得没有问题。
GLFW3默认构建为libglfw3
,而不是像GLFW2那样构建libglfw
。因此,您可能仍在链接您的GLFW2安装。
解决方案:
g++ example.cpp -o example -lGL -lglfw3
相关文章:
- 将对象数组的引用传递给函数
- 什么时候在C++中返回常量引用是个好主意
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- 何时在引用或唯一指针上使用移动语义
- 如何在c++中使用引用实现类似python的行为
- 编译C++时未定义的引用
- Ctypes wstring通过引用传递
- c++r值引用应用于函数指针
- 理解c++中的引用
- C++取消引用指针.为什么会发生变化
- 如何修复此错误:未定义对"距离(浮点数,浮点数,浮点数,浮点数,浮点数)"的引用
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- C++Boost Asio Pool线程,带有lambda函数和传递引用变量
- 强制转换为引用类型
- 引用一个已擦除类型(void*)的指针
- 向量元素的引用地址与它所指向的向量元素的地址不同.为什么
- 具有默认值的引用获取函数
- glfw3 编译未定义的引用
- glfw3缺少特定于glfw3的引用
- 无法链接 GLFW3:未定义的引用