我一直在关注arcsynthesis(arcsynthesis.org/gltut/)教程,并在make期间遇到以下错误。我使用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"
答案 0 :(得分:7)
您的Makefile中缺少-lX11
个开关,并且此特定链接器错误告诉您 libfreeglutD 取决于动态共享对象(DSO): libX11.so < / em>的
您必须将其添加到两个makefile:Tut\ 13\ Basic\ Impostor.make
和Tut\ 13\ Geometry\ Impostor.make
。很可能为了从Arcsynthesis运行其他教程,您将不得不这样做。