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

==== 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"

最佳答案

您在Makefile文件中缺少-lX11开关,并且此特定的链接器错误告诉您 libfreeglutD 取决于动态共享库(DSO):libX11.so。

您必须将其添加到两个makefile中:Tut\ 13\ Basic\ Impostor.makeTut\ 13\ Geometry\ Impostor.make。为了运行Arcsynthesis的其他教程,您很有可能必须做同样的事情。

08-16 07:08