Link problems against GLUT & OpenGL in MinGW

Well, here I have another stone in my path :stuck_out_tongue:

I’m trying to build an OF app with a custom Makefile I made. Everything seems to be alright, include paths for compiler and linker, needed libs, all of it. But…I get undefined references to symbols I think are from OpenGL and GLUT, like for example:

‘glDisable@0’ or ‘_glDisable@0’

I don’t remember now if they begin with underscore or not, but I think my problem has to do with it.
I’ve compiled the advancedGraphicsExample without problems so far, and I’ve copied the needed libs, include paths and everything to my Makefile without luck. I’ve tried even with --kill-at linker option, suposing it has to do with ‘@nn’ appended to symbols, but nothing changes and the problem still happens.

I’m building with MinGW included in Code::Blocks under Windows 7 32-bit.

Has anyone faced the same thing?

This is my Makefile:

  
  
.SUFFIXES: .cpp .o .prep  
  
############################  
SRC = 	Carton.cpp \  
		MegaLotto.cpp \  
		MegaLottoLogic.cpp \  
		ServerProtocol.cpp \  
		main.cpp  
  
############################  
OBJS = $(SRC:.cpp=.o)  
PREPS = $(SRC:.cpp=.prep)  
  
############################  
PROGS = megalotto.exe  
AR = ar  
CC = mingw32-g++.exe  
HOME = c:  
  
ifeq ($(OPENFRAMEWORKS), 1)  
	CFLAGS = -w -D__GRAPHICS_LIBRARY_OPENFRAMEWORKS -D__DEMO -D__DEMO_SIN_SERVER  
else  
	CFLAGS = -w -D__DEMO -D__DEMO_SIN_SERVER  
endif  
  
DBGFLAGS =  
ifeq ($(DEBUG),1)  
	DBGFLAGS = -g -Wno-deprecated-declarations  
else  
	DBGFLAGS = -O2  
endif  
  
LOCAL_INCLUDES = -I. -I..\NextEngine\Classes -I..\NextEngine\OldClasses -I..\NextEngine  
LOCAL_LFLAGS = -L..\NextEngine  
LOCAL_LIBS = -lnextEngine  
  
EXTERN_LIBS = $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\FreeImage\lib\win_cb\FreeImage.lib \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\rtAudio\lib\win_cb\RtAudio.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\quicktime\lib\win_cb\qtmlClient.lib \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\freetype\lib\win_cb\libfreetype.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\glut\lib\win_cb\libglut.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\videoInput\lib\win_cb\videoInputLib.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\fmodex\lib\win_cb\libfmodex.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\glee\lib\win_cb\GLee.lib \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\glu\lib\win_cb\glu32.lib \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\poco\lib\win_cb\libPocoNetmt.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\poco\lib\win_cb\libPocoUtilmt.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\poco\lib\win_cb\libPocoXMLmt.a \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\poco\lib\win_cb\libPocoFoundationmt.a \  
    -lopengl32 \  
    -lglu32 \  
    -ldsound \  
    -lwinmm \  
    -ldxguid \  
    -lstrmiids \  
    -lz \  
    -luuid \  
    -lole32 \  
    -loleaut32 \  
    -lsetupapi \  
    -lwsock32 \  
    -lws2_32 \  
    -lIphlpapi \  
    $(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworksCompiled\lib\win_cb\openFrameworks.lib  
  
ifeq ($(OPENFRAMEWORKS), 1)  
	INCLUDES = $(LOCAL_INCLUDES) \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\app \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\communication \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\events \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\graphics \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\sound \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\utils \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\openFrameworks\video \  
		\  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\fmodex\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\FreeImage\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\freetype\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\glee\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\gstappsink\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\poco\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\rtAudio\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\glut\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\quicktime\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\videoInput\include \  
		-I$(HOME)\of_preRelease_v0062_win_cb_FAT\libs\glu\include  
  
	LIBS = $(LOCAL_LIBS) \  
		$(EXTERN_LIBS)  
  
	LFLAGS = $(LOCAL_LFLAGS)  
endif  
  
############################  
all: $(PROGS)  
  
.cpp.prep: $(SRC)  
	$(CC) $(DBGFLAGS) $(CFLAGS) $(INCLUDES) -E $< -o $@  
  
.cpp.o: $(SRC)  
	$(CC) $(DBGFLAGS) $(CFLAGS) $(INCLUDES) -c $< -o $@  
  
$(PROGS) : $(OBJS)  
	$(CC) -o $@ $^ $(LFLAGS) $(LIBS)  
ifeq ($(DEBUG),0)  
	strip $(PROGS)  
endif  
  
prep: $(PREPS)  
  
depend:  
	makedepend -f- -- $(DBGFLAGS) $(CFLAGS) $(INCLUDES) $(SRC) > .deps  
  
clean:  
	del /Q /F $(OBJS)  
	del /Q /F $(PREPS)  
	del /Q /F $(PROGS)  
  
############################  
  
-include .deps  
  

Any help would be appreciated.

Please guys, this is an important part in a project at my work, what are the steps to compile in Windows? Which compiler should I use and how?

could you be missing GLEE library?

I’ll review the Makefile again, but I don’t think it has to do with a missing lib, I think it’s due to incompatibility in the symbols exported by the compiler in my app and the ones in the precompiled libs…

Still dunno what will I do…

EDIT: by the way, the Glee lib IS included in the linked libs so… :roll:

also check the order in which you include the libraries as that is frequently the cause of undefined symbols. if a library depends on another it should appear before it. For example if GLEE depends on glu which depends on GL the order should be:

GLEE
GLU
GL

that’s just an example i don’t know if that libraries depend on each other actually, although almost sure GLEE and GLU depend on GL so try changing the order in your makefile