Reputation: 101533
I'm just getting started using GLEW on Windows with MinGW. I can compile the program successfully (glew.h
and libglew.a
are in the proper place within MinGW), however executing my program throws the above error. glew32.dll
is present in the same directory as the executable, and I've found and attempted various solutions to my problem. However, my problem seems to be different to others - the error message is complaining that glewInit
cannot be found in the executable itself as opposed to glew32.dll
. I haven't managed to find anything about this on Google.
Here's the error:
As you can see, it's not complaining about not being able to find the glew method in a DLL, but in the program file itself. I feel I am linking the executable incorrectly, but I have very little experience with fixing this kind of error.
Here's my Makefile:
EXEC = test1.exe
SRC_FILES = test1.cpp wavefront.cpp
CXX = g++
CC = $(CXX)
DEBUG_LEVEL = -g
EXTRA_CCFLAGS = -Wall
CXXFLAGS = $(DEBUG_LEVEL) $(EXTRA_CCFLAGS)
CCFLAGS = $(CXXFLAGS)
CPPFLAGS = -I.
LDFLAGS = -L"/cygdrive/c/MinGW/lib"
LDLIBS = -lsfml-graphics -lsfml-window -lsfml-system -lopengl32 -lglu32 -lglew32
O_FILES = $(SRC_FILES:.cpp=.o)
all: .FORCE
.FORCE: compile link
compile:
$(CXX) -c $(SRC_FILES)
link:
$(CXX) $(O_FILES) -o $(EXEC) $(LDFLAGS) $(LDLIBS)
clean:
$(RM) $(O_FILES) *.exe *.rpo
Upvotes: 0
Views: 4160
Reputation: 43359
The error in your title and in your diagram are completely different. The first error, in your title is the decorated DLL export name and the second one is for a __stdcall
function. For whatever reason, the import stub seems to be trying to resolve the function address from your application rather than the DLL.
Perhaps you did not properly define dllexport
behavior when you built your DLL or dllimport
when linking against it? GLEW uses the pre-processor definition: GLEW_BUILD
for this purpose.
In any event, using the static linking glew library will definitely solve this issue, though I cannot say why it is happening for sure.
Link against glew32s
and add -DGLEW_STATIC
to your Makefile.
Upvotes: 2