1

我目前正按时使用 kinect openNi 和 NITE。事实上,我检测到手的位置,例如手是否在你的头上?为此,我需要更改 NITE 的 PointViewer。

但是,当我修改代码时无法编译。

事实上,当我在文件 PointViewer 中进行制作时,如果有错误,编译器会将它们全部报告给我,但是当我接近更正时,我发现书店的未定义参考错误实际上 Glut 就像他没有被包括在内,而对我来说,这是因为在 PointViewer 修改代码之前有效。

我已经安装了 freeglut3-dev 并包含了库和 . 如您所说,在建立链接时会出现问题。是否有任何编译器选项可以使链接成功?如何在 makefile 中添加编译器选项以便它可以找到 GLU 库在哪里?

你知道这可能是什么吗?

在这里我要注意:

g++ -o ../Bin/x64-Release/Sample-PointViewer ./x64-Release/main.o ./x64-Release/PointDrawer.o ./x64-Release/signal_catch.o  -L../Bin/x64-Release -lglut -lOpenNI -lXnVNite_1_5_2
./x64-Release/main.o:main.cpp:function glutDisplay(): error: undefined reference to 'glClear'
./x64-Release/main.o:main.cpp:function glutDisplay(): error: undefined reference to 'glMatrixMode'
./x64-Release/main.o:main.cpp:function glutDisplay(): error: undefined reference to 'glPushMatrix'
./x64-Release/main.o:main.cpp:function glutDisplay(): error: undefined reference to 'glLoadIdentity'
./x64-Release/main.o:main.cpp:function glutDisplay(): error: undefined reference to 'glOrtho'
./x64-Release/main.o:main.cpp:function glutDisplay(): error: undefined reference to 'glDisable'
./x64-Release/main.o:main.cpp:function glInit(int*, char**): error: undefined reference to 'glDisable'
./x64-Release/main.o:main.cpp:function glInit(int*, char**): error: undefined reference to 'glEnable'
./x64-Release/main.o:main.cpp:function glInit(int*, char**): error: undefined reference to 'glEnableClientState'
./x64-Release/main.o:main.cpp:function glInit(int*, char**): error: undefined reference to 'glDisableClientState'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function initTexture(void**, int&, int&): error: undefined reference to 'glGenTextures'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function initTexture(void**, int&, int&): error: undefined reference to 'glBindTexture'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function initTexture(void**, int&, int&): error: undefined reference to 'glTexParameteri'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function initTexture(void**, int&, int&): error: undefined reference to 'glTexParameteri'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawRectangle(float, float, float, float): error: undefined reference to 'glVertexPointer'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawRectangle(float, float, float, float): error: undefined reference to 'glDrawArrays'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawRectangle(float, float, float, float): error: undefined reference to 'glFlush'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawTexture(float, float, float, float): error: undefined reference to 'glEnableClientState'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawTexture(float, float, float, float): error: undefined reference to 'glTexCoordPointer'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawDepthMap(xn::DepthMetaData const&): error: undefined reference to 'glBindTexture'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawDepthMap(xn::DepthMetaData const&): error: undefined reference to 'glTexImage2D'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawDepthMap(xn::DepthMetaData const&): error: undefined reference to 'glColor4f'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawDepthMap(xn::DepthMetaData const&): error: undefined reference to 'glEnable'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawFrameID(unsigned int): error: undefined reference to 'glColor4f'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawFrameID(unsigned int): error: undefined reference to 'glRasterPos2i'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glColor4f'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glPointSize'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glVertexPointer'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glDrawArrays'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glColor4f'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glPointSize'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glDrawArrays'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function XnVPointDrawer::Draw() const: error: undefined reference to 'glFlush'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function PrintSessionState(SessionState): error: undefined reference to 'glRasterPos2i'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function PrintSessionState(SessionState): error: undefined reference to 'pthread_create'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function PrintSessionState(SessionState): error: undefined reference to 'pthread_join'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawTexture(float, float, float, float): error: undefined reference to 'glDisableClientState'
./x64-Release/PointDrawer.o:PointDrawer.cpp:function DrawDepthMap(xn::DepthMetaData const&): error: undefined reference to 'glDisable'
collect2: ld returned 1 exit status
make: *** [../Bin/x64-Release/Sample-PointViewer] Error 1

提前致谢

4

2 回答 2

0

第一个错误看起来与 GL/GLUT 相关。确保您已正确设置包含和库路径。

我刚刚使用 Qt Creator 在 osx 上编译了示例,但从项目中删除了 opengles.cpp,因为它正在寻找我在系统上找不到的库。如果有帮助,这是我的 Qt 控制台应用程序项目文件:

#-------------------------------------------------
#
# Project created by QtCreator 2012-08-01T01:22:11
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = NitePointViewer
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app

INCLUDEPATH += /usr/include/ni
INCLUDEPATH += /usr/include/nite
LIBS += /usr/lib/libXnCore.dylib
LIBS += /usr/lib/libXnDDK.dylib
LIBS += /usr/lib/libXnDeviceFile.dylib
LIBS += /usr/lib/libXnDeviceSensorV2.dylib
LIBS += /usr/lib/libXnFormats.dylib
LIBS += /usr/lib/libXnVCNITE_1_5_2.dylib
LIBS += /usr/lib/libXnVFeatures_1_5_2.dylib
LIBS += /usr/lib/libXnVNite_1_5_2.dylib
LIBS += /usr/lib/libnimCodecs.dylib
LIBS += /usr/lib/libnimMockNodes.dylib
LIBS += /usr/lib/libnimRecorder.dylib
LIBS += /usr/lib/libOpenNI.dylib
LIBS += -framework OpenGL
LIBS += -framework GLUT
LIBS += Libs/glut64.lib

SOURCES += main.cpp \
    signal_catch.cpp \
    PointDrawer.cpp \
    kbhit.cpp

HEADERS += \
    GL/wglext.h \
    GL/glut.h \
    GL/glext.h \
    GL/gl.h \
    GLES/gl.h \
    GLES/gl_1_0.h \
    GLES/egltypes.h \
    GLES/egl.h \
    GLES/egl_1_0.h \
    glh/glh_text.h \
    glh/glh_obs.h \
    glh/glh_mipmaps.h \
    glh/glh_linear.h \
    glh/glh_interactors.h \
    glh/glh_glut2.h \
    glh/glh_glut.h \
    glh/glh_glut_text.h \
    glh/glh_glut_replay.h \
    glh/glh_glut_callfunc.h \
    glh/glh_genext.h \
    glh/glh_extensions.h \
    glh/glh_cube_map.h \
    glh/glh_convenience.h \
    glh/glh_array.h \
    signal_catch.h \
    PointDrawer.h \
    opengles.h \
    kbhit.h

和生成的 Makefile:

#############################################################################
# Makefile for building: NitePointViewer
# Generated by qmake (2.01a) (Qt 4.7.4) on: Wed Aug 1 01:50:26 2012
# Project:  NitePointViewer.pro
# Template: app
# Command: /Users/george/QtSDK/Desktop/Qt/474/gcc/bin/qmake -spec ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++ -o Makefile NitePointViewer.pro
#############################################################################

####### Compiler, tools and options

CC            = gcc
CXX           = g++
DEFINES       = -DQT_CORE_LIB
CFLAGS        = -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W $(DEFINES)
CXXFLAGS      = -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W $(DEFINES)
INCPATH       = -I../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++ -I. -I../../../QtSDK/Desktop/Qt/474/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/474/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/474/gcc/include -I/usr/include/ni -I/usr/include/nite -I. -F/Users/george/QtSDK/Desktop/Qt/474/gcc/lib
LINK          = g++
LFLAGS        = -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5
LIBS          = $(SUBLIBS) -F/Users/george/QtSDK/Desktop/Qt/474/gcc/lib -L/Users/george/QtSDK/Desktop/Qt/474/gcc/lib /usr/lib/libXnCore.dylib /usr/lib/libXnDDK.dylib /usr/lib/libXnDeviceFile.dylib /usr/lib/libXnDeviceSensorV2.dylib /usr/lib/libXnFormats.dylib /usr/lib/libXnVCNITE_1_5_2.dylib /usr/lib/libXnVFeatures_1_5_2.dylib /usr/lib/libXnVNite_1_5_2.dylib /usr/lib/libnimCodecs.dylib /usr/lib/libnimMockNodes.dylib /usr/lib/libnimRecorder.dylib /usr/lib/libOpenNI.dylib -framework OpenGL -framework GLUT Libs/glut64.lib -framework QtCore 
AR            = ar cq
RANLIB        = ranlib -s
QMAKE         = /Users/george/QtSDK/Desktop/Qt/474/gcc/bin/qmake
TAR           = tar -cf
COMPRESS      = gzip -9f
COPY          = cp -f
SED           = sed
COPY_FILE     = cp -f
COPY_DIR      = cp -f -R
STRIP         = 
INSTALL_FILE  = $(COPY_FILE)
INSTALL_DIR   = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE      = rm -f
SYMLINK       = ln -f -s
DEL_DIR       = rmdir
MOVE          = mv -f
CHK_DIR_EXISTS= test -d
MKDIR         = mkdir -p
export MACOSX_DEPLOYMENT_TARGET = 10.4

####### Output directory

OBJECTS_DIR   = ./

####### Files

SOURCES       = main.cpp \
        signal_catch.cpp \
        PointDrawer.cpp \
        kbhit.cpp 
OBJECTS       = main.o \
        signal_catch.o \
        PointDrawer.o \
        kbhit.o
DIST          = ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/unix.conf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/mac.conf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/mac-g++.conf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/qconfig.pri \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/modules/qt_webkit_version.pri \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt_functions.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt_config.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/exclusive_builds.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/default_pre.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/default_pre.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/dwarf2.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/debug.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/default_post.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/default_post.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/x86_64.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/objective_c.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/warn_on.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/unix/thread.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/moc.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/rez.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/sdk.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/resources.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/uic.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/yacc.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/lex.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/include_source_dir.prf \
        NitePointViewer.pro
QMAKE_TARGET  = NitePointViewer
DESTDIR       = 
TARGET        = NitePointViewer

####### Custom Compiler Variables
QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS = -pipe \
        -g \
        -gdwarf-2 \
        -arch \
        x86_64 \
        -Xarch_x86_64 \
        -mmacosx-version-min=10.5 \
        -Wall \
        -W


first: all
####### Implicit rules

.SUFFIXES: .o .c .cpp .cc .cxx .C

.cpp.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.cc.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.cxx.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.C.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.c.o:
    $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"

####### Build rules

all: Makefile $(TARGET)

$(TARGET):  $(OBJECTS)  
    $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

Makefile: NitePointViewer.pro  ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++/qmake.conf ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/unix.conf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/mac.conf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/mac-g++.conf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/qconfig.pri \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/modules/qt_webkit_version.pri \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt_functions.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt_config.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/exclusive_builds.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/default_pre.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/default_pre.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/dwarf2.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/debug.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/default_post.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/default_post.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/x86_64.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/objective_c.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/warn_on.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/unix/thread.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/moc.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/rez.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/sdk.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/resources.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/uic.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/yacc.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/lex.prf \
        ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/include_source_dir.prf
    $(QMAKE) -spec ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++ -o Makefile NitePointViewer.pro
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/unix.conf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/mac.conf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/common/mac-g++.conf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/qconfig.pri:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/modules/qt_webkit_version.pri:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt_functions.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt_config.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/exclusive_builds.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/default_pre.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/default_pre.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/dwarf2.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/debug.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/default_post.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/default_post.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/x86_64.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/objective_c.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/warn_on.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/qt.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/unix/thread.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/moc.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/rez.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/mac/sdk.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/resources.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/uic.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/yacc.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/lex.prf:
../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/features/include_source_dir.prf:
qmake:  FORCE
    @$(QMAKE) -spec ../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++ -o Makefile NitePointViewer.pro

dist: 
    @$(CHK_DIR_EXISTS) .tmp/NitePointViewer1.0.0 || $(MKDIR) .tmp/NitePointViewer1.0.0 
    $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/NitePointViewer1.0.0/ && $(COPY_FILE) --parents GL/wglext.h GL/glut.h GL/glext.h GL/gl.h GLES/gl.h GLES/gl_1_0.h GLES/egltypes.h GLES/egl.h GLES/egl_1_0.h glh/glh_text.h glh/glh_obs.h glh/glh_mipmaps.h glh/glh_linear.h glh/glh_interactors.h glh/glh_glut2.h glh/glh_glut.h glh/glh_glut_text.h glh/glh_glut_replay.h glh/glh_glut_callfunc.h glh/glh_genext.h glh/glh_extensions.h glh/glh_cube_map.h glh/glh_convenience.h glh/glh_array.h signal_catch.h PointDrawer.h opengles.h kbhit.h .tmp/NitePointViewer1.0.0/ && $(COPY_FILE) --parents main.cpp signal_catch.cpp PointDrawer.cpp kbhit.cpp .tmp/NitePointViewer1.0.0/ && (cd `dirname .tmp/NitePointViewer1.0.0` && $(TAR) NitePointViewer1.0.0.tar NitePointViewer1.0.0 && $(COMPRESS) NitePointViewer1.0.0.tar) && $(MOVE) `dirname .tmp/NitePointViewer1.0.0`/NitePointViewer1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/NitePointViewer1.0.0


clean:compiler_clean 
    -$(DEL_FILE) $(OBJECTS)
    -$(DEL_FILE) *~ core *.core


####### Sub-libraries

distclean: clean
    -$(DEL_FILE) $(TARGET) 
    -$(DEL_FILE) Makefile


check: first

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_objective_c_make_all:
compiler_objective_c_clean:
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
    -$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_rez_source_make_all:
compiler_rez_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: 

####### Compile

main.o: main.cpp PointDrawer.h \
        GL/glut.h \
        GL/gl.h \
        GL/glext.h \
        opengles.h \
        GLES/gl.h \
        GLES/egl.h \
        GLES/egltypes.h \
        kbhit.h \
        signal_catch.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp

signal_catch.o: signal_catch.cpp signal_catch.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o signal_catch.o signal_catch.cpp

PointDrawer.o: PointDrawer.cpp PointDrawer.h \
        GL/glut.h \
        GL/gl.h \
        GL/glext.h \
        opengles.h \
        GLES/gl.h \
        GLES/egl.h \
        GLES/egltypes.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o PointDrawer.o PointDrawer.cpp

kbhit.o: kbhit.cpp kbhit.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o kbhit.o kbhit.cpp

####### Install

install:   FORCE

uninstall:   FORCE

FORCE:

我还在 main.cpp 和 PointDrawer.cpp 中添加了:

#define USE_GLUT
于 2012-08-01T01:01:03.427 回答
0

您需要在链接过程中添加一些库。从添加 -lGL -lpthread 开始。(glClear 在 libGL.so 中定义,pthread 在 libpthread.so 中。这是在 Linux 上 - 您可能需要在 Ubuntu 上安装 freeglut3-dev 软件包才能获得 libGL。)

于 2012-08-01T00:35:00.817 回答