问题
I am trying to compile an X11 application on Mac OS X using XQuartz (i.e. XQuartz provides an X11 implementation, so the code should compile directly).
The X11 code, however, is sophisticated enough to require OpenGL extensions through GLEW. This almost works, but a few symbols remain undefined. Here's the relevant, cleaned-up output of the verbose link:
"/usr/bin/ld" [flags] -o [out] [lib-dirs] [obj-file] [CustomLib2 CustomLib1] -lX11.6 -lGLEW -lGLEW.1.10 -lc++ -lstdc++ -lSystem /usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"___glewXChooseFBConfig", referenced from: [place in CustomLib2]
"___glewXCreateContextAttribsARB", referenced from: [place in CustomLib2]
"___glewXSwapIntervalEXT", referenced from: [place in CustomLib2]
I checked the libraries, and they don't have any __glewX*
symbols (though they have lots of __glew*
symbols), despite this suggesting they should be there. I.e., these commands both come up empty:
nm /usr/lib/libGLEW.a | grep __glewX
nm /usr/lib/libGLEW.1.10.0.dylib | grep __glewX
My question: where are the __glewX*
symbols located?
N.B. I am not using XCode or CMake. This is a simple makefile build.
来源:https://stackoverflow.com/questions/27813935/glewx-undefined-symbols-in-xquartz-build