• Advertisement
Sign in to follow this  

SDL+linux+windows+devcpp headache

This topic is 4305 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have some problems when compiling/linking (on windows with DevC++) my SDL project which i wrote in linux. Does anyone have an idea on what i need to add in the makefile so that i won't get these errors?
  [Linker error] undefined reference to `SDL_GetError' 
  [Linker error] undefined reference to `SDL_SetModuleHandle' 

i am using my linux makefile which i compiled (converted) to windows using devc++.

Share this post


Link to post
Share on other sites
Advertisement
Do you have it setup to link everything properly? I just dug up an old backup CD with some crap from when I was tinkering with SDL in linux, and found this in the makefiles:

LDFLAGS = `sdl-config --libs`

Looks like that's a script that gets installed with the SDL libs to make it less of a pain in the ass to figure out where to point it. Hope this helps!

Share this post


Link to post
Share on other sites
Whoops sorry, I completely missed your question haha. I thought you were trying to get it to work in linux.

In Dev-C++, just make sure you set it up to point at the right 'lib' directory (where you installed your SDL stuff).

I do have this in another makefile (this one is for Dev-C++):


DEVPATH="C:\Dev-C++"
CFLAGS=-s -lmingw32 -lSDLmain -lSDL -IC:\$(DEVPATH)\INCLUDE\ -IC:\$(DEVPATH)\INCLUDE\$(GPP) -IC:\$(DEVPATH)\INCLUDE\ -LC:\$(DEVPATH)\LIB\ -BC:\$(DEVPATH)\BIN\

Share this post


Link to post
Share on other sites
thanks for the reply ...

i think it points to the includes because it doesn't give errors when linking SDL_gfx, SDL_image or SDL_ttf

if it helpes here is the win version of the makefile


# Project: Asteroids
# Makefile created by Dev-C++ 4.9.9.2

CPP = g++.exe -D__DEBUG__
CC = gcc.exe -D__DEBUG__
WINDRES = windres.exe
RES =
OBJ = Asteroids.o Input.o SDLCharacter.o SDLGraphics.o SDLText.o SDLTimer.o $(RES)
LINKOBJ = Asteroids.o Input.o SDLCharacter.o SDLGraphics.o SDLText.o SDLTimer.o $(RES)
LIBS = -L"D:/Dev-Cpp/lib" -lmingw32 -lSDL -lSDLmain -lSDL_ttf -lSDL_image -lSDL_gfx -g3
INCS = -I"D:/Dev-Cpp/include"
CXXINCS = -I"D:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"D:/Dev-Cpp/include/c++/3.4.2/backward" -I"D:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"D:/Dev-Cpp/include/c++/3.4.2" -I"D:/Dev-Cpp/include"
BIN = Asteroids.exe
CXXFLAGS = $(CXXINCS) -g3
CFLAGS = $(INCS) -g3
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before Asteroids.exe all-after


clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "Asteroids.exe" $(LIBS)

Asteroids.o: Asteroids.cpp
$(CPP) -c Asteroids.cpp -o Asteroids.o $(CXXFLAGS)

Input.o: Input.cpp
$(CPP) -c Input.cpp -o Input.o $(CXXFLAGS)

SDLCharacter.o: SDLCharacter.cpp
$(CPP) -c SDLCharacter.cpp -o SDLCharacter.o $(CXXFLAGS)

SDLGraphics.o: SDLGraphics.cpp
$(CPP) -c SDLGraphics.cpp -o SDLGraphics.o $(CXXFLAGS)

SDLText.o: SDLText.cpp
$(CPP) -c SDLText.cpp -o SDLText.o $(CXXFLAGS)

SDLTimer.o: SDLTimer.cpp
$(CPP) -c SDLTimer.cpp -o SDLTimer.o $(CXXFLAGS)





EDIT: typos

Share this post


Link to post
Share on other sites
This is a long shot, but try swapping the orders of -lSDL and -lSDLmain. I googled, and found that to work for some people.

cheers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement