Reputation: 454
I am working on a project which uses GLFW and GLEW. I can compile it perfectly without error messages but when I run it it prompts this:
/home/doc/main: error while loading shared libraries: libGLEW.so.1.12: cannot open shared object file: No such file or directory
I added #define GLEW_STATIC on top of my main file, so it shouldn't find it as a shared library, should it? Do you have any idea of what could it be? Thanks in advance.
EDIT: On my Qt project file I append this into LIBS
LIBS += -L/usr/local/lib -lglfw -lGL -lGLU -lX11 -lGLEW
Upvotes: 0
Views: 6609
Reputation: 45362
#define GLEW_STATIC
does in no way influence the linker - this is actually only needed for Windows platforms, where in the dynamic versions, dllspec
declarations are added.
If you want to link statically to GLEW, you need a static .lib
file and have to point your linker to link against that.
However, in the case of GLEW, you can also directly integrate glew.c
into your project, and link the object file, so that no library is needed at all.
Upvotes: 4