尝试编译我的第一个 opengl/mesa 应用程序

发布于 2024-11-10 07:36:43 字数 10763 浏览 0 评论 0原文

我正在尝试编译我的第一个程序 openGL 应用程序。

这是我的代码:

#include <GL/gl.h>      
#include <GL/glu.h>     
#include <GL/glut.h>    

using namespace std;

int main(int argc, char** argv) {

    glutInit(&argc, argv);

    return 0;
}

然后我将 /usr/lib/libglut.a 链接到该项目。

当我尝试编译时出现此错误:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/tirengarfio/programacion/3Ded'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/3ded
make[2]: Entering directory `/home/tirengarfio/programacion/3Ded'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++    -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++     -o dist/Debug/GNU-Linux-x86/3ded build/Debug/GNU-Linux-x86/main.o /usr/lib/libglut.a 
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fghGetWindowProperty':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fghGetAtom':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fgDeinitialize':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fgDeinitialize':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fgDeinitialize':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `fghcbDisplayWindow':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `fghcbDisplayWindow':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `fghcbDisplayWindow':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoop':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fghGetVMaxExtent':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o):(.text+0xf93): more undefined references to `glVertex2i' follow
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
make[2]: Leaving directory `/home/tirengarfio/programacion/3Ded'
make[1]: Leaving directory `/home/tirengarfio/programacion/3Ded'
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o):(.text+0x1043): more undefined references to `glVertex2i' follow
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `fghGetConfig':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGetModeValues':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGetModeValues':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGetModeValues':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutDeviceGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `toggle_fullscreen':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `toggle_fullscreen':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `toggle_fullscreen':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutPopWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutPushWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutPositionWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetIconTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetIconTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetWindowTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetWindowTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutIconifyWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutIconifyWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutHideWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutHideWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutHideWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutShowWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutShowWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgCloseWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgCloseWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgCloseWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fghCreateNewContext':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgSetWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgChooseFBConfig':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgChooseFBConfig':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgChooseFBConfig':
...
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/3ded] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)

知道吗?

Ubuntu 10.04/Netbeans 6.9.1

I'm trying to compile my first program openGL app.

This is my code:

#include <GL/gl.h>      
#include <GL/glu.h>     
#include <GL/glut.h>    

using namespace std;

int main(int argc, char** argv) {

    glutInit(&argc, argv);

    return 0;
}

I have then linked /usr/lib/libglut.a to the project.

When I try to compile I'm getting this error:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/tirengarfio/programacion/3Ded'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/3ded
make[2]: Entering directory `/home/tirengarfio/programacion/3Ded'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++    -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++     -o dist/Debug/GNU-Linux-x86/3ded build/Debug/GNU-Linux-x86/main.o /usr/lib/libglut.a 
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fghGetWindowProperty':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fghGetAtom':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `glutInit':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fgDeinitialize':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fgDeinitialize':
/usr/lib/libglut.a(libglut_la-freeglut_init.o): In function `fgDeinitialize':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `fghcbDisplayWindow':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `fghcbDisplayWindow':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `fghcbDisplayWindow':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoopEvent':
/usr/lib/libglut.a(libglut_la-freeglut_main.o): In function `glutMainLoop':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fghGetVMaxExtent':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o):(.text+0xf93): more undefined references to `glVertex2i' follow
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
make[2]: Leaving directory `/home/tirengarfio/programacion/3Ded'
make[1]: Leaving directory `/home/tirengarfio/programacion/3Ded'
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o):(.text+0x1043): more undefined references to `glVertex2i' follow
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_menu.o): In function `fgDisplayMenu':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `fghGetConfig':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGetModeValues':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGetModeValues':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGetModeValues':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutDeviceGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_state.o): In function `glutGet':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `toggle_fullscreen':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `toggle_fullscreen':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `toggle_fullscreen':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutPopWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutPushWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutPositionWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetIconTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetIconTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetWindowTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutSetWindowTitle':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutIconifyWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutIconifyWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutHideWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutHideWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutHideWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutShowWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `glutShowWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgCloseWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgCloseWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgCloseWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fghCreateNewContext':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgSetWindow':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgChooseFBConfig':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgChooseFBConfig':
/usr/lib/libglut.a(libglut_la-freeglut_window.o): In function `fgChooseFBConfig':
...
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/3ded] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)

Any idea?

Ubuntu 10.04/Netbeans 6.9.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你好,陌生人 2024-11-17 07:36:43

线索在这里:
更多对“glVertex2i”的未定义引用如下

基本上,您还需要链接到 OpenGL 库(glVertex2i 是一个 OpenGL 函数), glut 不提供 OpenGL 函数,只提供附加函数以使生活变得轻松。

尝试将 -lGL 添加到命令行(最后)。

编辑:这仅适用于静态版本(/usr/lib/libglut.a)。共享对象版本知道如何找到 libGL,因此您可以简单地使用 -lglut 而不是 /usr/lib/libglut.a。

The clue is here:
more undefined references to 'glVertex2i' follow

Basically you need to link against the OpenGL library as well (glVertex2i is an OpenGL function), glut doesn't provide OpenGL functions, only additional functions to make life easy.

Try adding -lGL to the command line (at the end).

EDIT: This is only true for the static version (/usr/lib/libglut.a). The shared object version knows how to find libGL, so you can simply use -lglut instead of /usr/lib/libglut.a.

楠木可依 2024-11-17 07:36:43

假设您的系统上安装了所有共享库,对于 C 源代码:

gcc hello.c -o hello -lGL -lglut -lGLU

对于 C++ 代码:

g++ hello.cpp -o hello -lGL -lglut -lGLU

如果确实不需要,请不要使用静态库 files.a。否则,您将必须自己满足这些依赖关系。

Assuming you have all the shared libraries installed on your system, for a C source code:

gcc hello.c -o hello -lGL -lglut -lGLU

For a C++ code:

g++ hello.cpp -o hello -lGL -lglut -lGLU

Don't use the static libraries files.a if you really don't need to. Else you'll have to satisfy those dependencies on your own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文