C++ Arcsynthesis OpenGL 3.3教程的问题-出错

C++ Arcsynthesis OpenGL 3.3教程的问题-出错,c++,opengl,ubuntu,makefile,C++,Opengl,Ubuntu,Makefile,我一直在学习arcsynthesis(arcsynthesis.org/gltut/)教程,在制作过程中遇到了以下错误。我使用premake4 gmake生成生成文件 ==== Building Tut 13 Basic Impostor (debug) ==== Creating obj/Debug/Tut 13 Basic Impostor BasicImpostor.cpp Linking Tut 13 Basic Impostor /usr/bin/ld: ../glsdk/freegl

我一直在学习arcsynthesis(arcsynthesis.org/gltut/)教程,在制作过程中遇到了以下错误。我使用premake4 gmake生成生成文件

==== Building Tut 13 Basic Impostor (debug) ====
Creating obj/Debug/Tut 13 Basic Impostor
BasicImpostor.cpp
Linking Tut 13 Basic Impostor
/usr/bin/ld: ../glsdk/freeglut/lib/libfreeglutD.a(freeglut_window.o): undefined reference to symbol 'XGetWindowAttributes'
/usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Tut 13 Basic ImpostorD] Error 1
make: *** [Tut 13 Basic Impostor] Error 2
这是我的makefile。我不确定这是否是你想要的,因为我是Ubuntu的初学者:

# GNU Make solution makefile autogenerated by Premake
# Type "make help" for usage help

ifndef config
  config=debug
endif
export config

PROJECTS := framework Tut\ 13\ Basic\ Impostor Tut\ 13\ Geometry\ Impostor

.PHONY: all clean help $(PROJECTS)

all: $(PROJECTS)

framework: 
    @echo "==== Building framework ($(config)) ===="
    @${MAKE} --no-print-directory -C ../framework -f Makefile

Tut\ 13\ Basic\ Impostor: framework
    @echo "==== Building Tut 13 Basic Impostor ($(config)) ===="
    @${MAKE} --no-print-directory -C . -f Tut\ 13\ Basic\ Impostor.make

Tut\ 13\ Geometry\ Impostor: framework
    @echo "==== Building Tut 13 Geometry Impostor ($(config)) ===="
    @${MAKE} --no-print-directory -C . -f Tut\ 13\ Geometry\ Impostor.make

clean:
    @${MAKE} --no-print-directory -C ../framework -f Makefile clean
    @${MAKE} --no-print-directory -C . -f Tut\ 13\ Basic\ Impostor.make clean
    @${MAKE} --no-print-directory -C . -f Tut\ 13\ Geometry\ Impostor.make clean

help:
    @echo "Usage: make [config=name] [target]"
    @echo ""
    @echo "CONFIGURATIONS:"
    @echo "   debug"
    @echo "   release"
    @echo ""
    @echo "TARGETS:"
    @echo "   all (default)"
    @echo "   clean"
    @echo "   framework"
    @echo "   Tut 13 Basic Impostor"
    @echo "   Tut 13 Geometry Impostor"
    @echo ""
    @echo "For more information, see http://industriousone.com/premake/quick-start"

Makefiles中缺少
-lX11
开关,此特定链接器错误告诉您libfreeglutD取决于动态共享对象(DSO):libX11.so


您必须将其添加到两个make文件中:
Tut\13\Basic\Impostor.make
Tut\13\Geometry\Impostor.make
。为了从Arcsynthesis运行其他教程,您很可能需要执行相同的操作。

能否显示实际的链接器/对象输入参数。通常,如果您忘记链接其他对象所需的动态共享对象,则会出现这种情况
-lX11
几乎肯定会解决您的问题。一些工具链对您指示的依赖库的顺序也非常挑剔(例如,
-lX11
需要在
-lfreeglud
之后)。这并不是必需的;重要的是
Tut\13\Basic\Impostor.make
的内容。这就是说,这个问题可能会弹出的几何冒名顶替建立目标,以及一旦你得到基本的冒名顶替工作。非常感谢你。正如你所说的。我将-lX11添加到几何视点替用特效和基本视点替用特效中,它成功了!如果您愿意,请添加此评论作为答案,我将接受:)