glfw3 compilation de références indéfinies
J'ai un problème avec la compilation de mon programme qui utilise glfw3 bibliothèque.
J'obtiens la liste des erreurs de undefined références lorsque vous essayez de compiler avec faire, mais mes cours sont compilés dans .o fichiers fichier exécutable final n'est pas créé.
stdout:
g++ -Wall -g -c main.cpp -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi
g++ -Wall -g -c error.cpp -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi
g++ -Wall -g -c sWindow.cpp -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi
g++ -Wall -g -o ecl main.o error.o sWindow.o -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi
stderr:
/usr/local/lib/libglfw3.a(context.c.o): In function `parseGLVersion':
context.c:(.text+0x53): undefined reference to `glGetString'
/usr/local/lib/libglfw3.a(context.c.o): In function `_glfwRefreshContextAttribs':
context.c:(.text+0x907): undefined reference to `glGetIntegerv'
context.c:(.text+0x98a): undefined reference to `glGetIntegerv'
context.c:(.text+0x9df): undefined reference to `glGetIntegerv'
context.c:(.text+0xa32): undefined reference to `glGetIntegerv'
/usr/local/lib/libglfw3.a(context.c.o): In function `glfwExtensionSupported':
context.c:(.text+0xd59): undefined reference to `glGetString'
context.c:(.text+0xd93): undefined reference to `glGetIntegerv'
/usr/local/lib/libglfw3.a(window.c.o): In function `glfwCreateWindow':
window.c:(.text+0x6f8): undefined reference to `glClear'
/usr/local/lib/libglfw3.a(x11_time.c.o): In function `getRawTime':
x11_time.c:(.text+0x20): undefined reference to `clock_gettime'
/usr/local/lib/libglfw3.a(x11_time.c.o): In function `_glfwInitTimer':
x11_time.c:(.text+0x72): undefined reference to `clock_gettime'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `getFBConfigAttrib':
glx_context.c:(.text+0x51): undefined reference to `glXGetFBConfigAttrib'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `chooseFBConfig':
glx_context.c:(.text+0x7e): undefined reference to `glXGetClientString'
glx_context.c:(.text+0x104): undefined reference to `glXGetFBConfigs'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `createLegacyContext':
glx_context.c:(.text+0x43f): undefined reference to `glXCreateNewContext'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwInitContextAPI':
glx_context.c:(.text+0x48f): undefined reference to `glXQueryExtension'
glx_context.c:(.text+0x4ca): undefined reference to `glXQueryVersion'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwCreateContext':
glx_context.c:(.text+0x791): undefined reference to `glXGetVisualFromFBConfig'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwDestroyContext':
glx_context.c:(.text+0xd09): undefined reference to `glXDestroyContext'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformMakeContextCurrent':
glx_context.c:(.text+0xd55): undefined reference to `glXMakeCurrent'
glx_context.c:(.text+0xd70): undefined reference to `glXMakeCurrent'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformSwapBuffers':
glx_context.c:(.text+0xdc2): undefined reference to `glXSwapBuffers'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformExtensionSupported':
glx_context.c:(.text+0xe69): undefined reference to `glXQueryExtensionsString'
/usr/local/lib/libglfw3.a(glx_context.c.o): In function `_glfwPlatformGetProcAddress':
glx_context.c:(.text+0xeb1): undefined reference to `glXGetProcAddressARB'
collect2: ld returned 1 exit status
make: *** [ecl] Error 1
c'est mon makefile:
CXX = g++
CXXFLAGS = -Wall -g
LIBS = -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi
DEPENDENCIES = main.o error.o sWindow.o
# ****************************************************
# Targets needed to bring the executable up to date
ecl: $(DEPENDENCIES)
$(CXX) $(CXXFLAGS) -o ecl $(DEPENDENCIES) $(LIBS)
main.o: main.cpp
$(CXX) $(CXXFLAGS) -c main.cpp $(LIBS)
error.o: error.cpp
$(CXX) $(CXXFLAGS) -c error.cpp $(LIBS)
sWindow.o: sWindow.cpp
$(CXX) $(CXXFLAGS) -c sWindow.cpp $(LIBS)
clean:
rm -f *.o main
echo "Clean done"
Avez-vous une idée de ce qui cause de ce problème et comment le résoudre?
OriginalL'auteur mezo | 2013-10-14
Vous devez vous connecter pour publier un commentaire.
Le faire dans cet ordre:
À la place de celui-ci:
GCC est très sensible à l'ordre dans lequel vous spécifiez les bibliothèques au cours de l'étape de lien. Par exemple, si
libA.a
dépendlibB.a
, alors vous devez appeler l'éditeur de liens de la façon suivante:Dans votre cas,
libglfw3.a
dépend évidemment delibGL.a
, d'où les erreurs que vous obtenez.Ne sais pas exactement, mais pour moi
-lglfw
travaillé au lieu de-lglfw3
OriginalL'auteur Alexander Shukaev