Author Topic: linker prob  (Read 5710 times)

QarateKid

  • Guest
linker prob
« on: November 08, 2006, 02:07:16 pm »
hallo,
ich bin gerade von devcpp zu code::blocks gewechselt. Sehr schöne ide, aber ich habe ein problem mit dem linker und weiß nich woran es liegt.
In meinem Projekt(, welches auf devcpp ohne weiteres zu compilieren und zu linken geht)
verwende ich eine eigene static lib, welche wiederum SDL verwendet(das projekt selbst verwendet ebenfalls SDL).
Die entsprechenden Ordner und das obligatorische -lSDL habe ich eingestellt.
Jedoch bekomme ich undefined references(nur bzgl der static lib)...:
Lib\gPack.a(gText.o)(.text+0xa3f):gText.cpp: undefined reference to `SDL_FreeSurface'
Lib\gPack.a(gText.o)(.text+0xb4b):gText.cpp: undefined reference to `SDL_FreeSurface'
.......
Die lib selbst habe ich erfolgreich gelinkt und compiliert bekommen.
habe ich irgendwas übersehen? Legt cb eigentlich auch irgendwo ein makefile an, wenn ja wo?
Ich verwende das aktuelle nightly build und minGW 5.0.3 habe es aber auch mit dem alten von devcpp ausprobiert(minGW 3.4.2)
Ich bin mit meinem Latein am ende und freue mich über jeden guten Rat, gruß

bigbug

  • Guest
Re: linker prob
« Reply #1 on: November 08, 2006, 02:21:23 pm »
Did You setup the libs in the correct order? The most basic ones have to be at the bottom in the list. This means Your gPack has to be above SDL.

QarateKid

  • Guest
Re: linker prob
« Reply #2 on: November 08, 2006, 02:54:02 pm »
i think i have, i tried a lot.
the problem is that you link SDL via -lSDL linkeroption and a simple static lib by linking the .lib or .a...
so i have:
Link Libraries:                           Other Linker Options:
Lib\gPack.a                              -lSDL
SDL\SDL_ttf.dll
SDL\SDL_image.dll

same result!
So how could i change the order?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: linker prob
« Reply #3 on: November 08, 2006, 03:00:16 pm »
hallo,
ich bin gerade von devcpp zu code::blocks gewechselt. Sehr schöne ide, aber ich habe ein problem mit dem linker und weiß nich woran es liegt.[...]
Englisch wäre ganz freundlich, weil das die meisten unserer Benutzer tatsächlich auch verstehen...

Regarding the topic: you can simply add "SDL" (without quotes) to the link libraries, no need to do -lSDL.
« Last Edit: November 08, 2006, 03:01:58 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

bigbug

  • Guest
Re: linker prob
« Reply #4 on: November 08, 2006, 03:01:43 pm »
assuming libSDL.a is in one of your linker-directories try this

Link Libraries:                         
Lib\gPack.a                           
SDL\SDL_ttf.dll
SDL\SDL_image.dll
SDL

and leave "Other Linker Options" empty

QarateKid

  • Guest
Re: linker prob
« Reply #5 on: November 08, 2006, 03:16:53 pm »
assuming libSDL.a is in one of your linker-directories try this

Link Libraries:                         
Lib\gPack.a                           
SDL\SDL_ttf.dll
SDL\SDL_image.dll
SDL

and leave "Other Linker Options" empty

thank you very much, that was it, its working!!! now i'm happy
and from now on in english, wasn't aware of writing in german, sry
perhaps this should be added to the wiki <using SDL in cb>, shouldn't it? couldn't find it there.
cya and thx a lot