【发布时间】:2015-01-27 10:49:57
【问题描述】:
在我看来,我已经正确安装和配置了 GLFW 3, 否则我的编译器会告诉我。
glfw3.h 和 glfw3native.h 在 urs/local/include/GLFW/ 中。
libglfw3.a 在 urs/local/lib/ 中。
在 Eclipse 中,我在 Project Propreties->C/C++ Build->Settings->GCC C Linker->Libraries 中配置了以下值:GL、GLU、m、rt、pthread、m、glfw3、X11、Xxf86vm、 Xrandr 和 Xi。
在我的项目中,在 Test.c 我有以下测试代码:
/*
============================================================================
Name : Test.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <GLFW/glfw3.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
if (!glfwInit())
exit(EXIT_FAILURE);
return EXIT_SUCCESS;
}
因此,在我看来,以及我在互联网上阅读的内容,这似乎是一个不错的设置。 当我编译它时,它给出了这个:
/usr/local/lib/libglfw3.a(window.c.o): In function `glfwCreateWindow':
window.c:(.text+0x724): undefined reference to `glClear'
//usr/local/lib/libglfw3.a(glx_context.c.o): In function `getFBConfigAttrib':
glx_context.c:(.text+0x4d): undefined reference to `glXGetFBConfigAttrib'
//usr/local/lib/libglfw3.a(glx_context.c.o): In function `chooseFBConfig':
glx_context.c:(.text+0x7a): undefined reference to `glXGetClientString'
glx_context.c:(.text+0xe5): undefined reference to `glXGetFBConfigs'
//usr/local/lib/libglfw3.a(glx_context.c.o): In function `createLegacyContext':
glx_context.c:(.text+0x41f): undefined reference to `glXCreateNewContext'
读到这里,我得出的结论是它没有找到 OpenGL,但是我之前已经制作了 OpenGL 项目并且它可以工作,那么为什么 GLFW 可以找到它呢? 谢谢。
【问题讨论】: