• ### Popular Now

• 12
• 12
• 9
• 10
• 13

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

## Recommended Posts

##### Share on other sites
Dev C++ uses the GNU compiler collection, GCC. When linking libraries with GCC, order is important: the linker does not go back over previously read libraries to satisfy newly introduced unresolved symbols from later libraries. Your SDL_image may work only because it relies exclusively on resolved symbols at the point it's being encountered.

In other words, you need to put your libraries that depend on, say, libSDL, to the left of that library in the link line. It's okay to have a libvrary appear more than once in a link line, if necessary (although that implies you've got circular dependencies. Directed acyclic graphs are preferrable).

##### Share on other sites
Thanks, I was doing it right to left before. Still not working though; I now have it like this:
-SDL_gfx -lSDL_input -lSDL_image -lSDL_ttf -lmingw32 -lSDLmain -lSDL

SDL_gfx is the only one who is giving me problems.

Here is the .h file, is anything wrong with it?
#include <iostream>#include "SDL\SDL.h"#include "SDL\SDL_image.h"#include "SDL\SDL_ttf.h"#ifndef MAIN_PARAM#define MAIN_PARAM int argc, char* args[]#endif#ifndef FRAME_VALUES#define FRAME_VALUES 10#endif#ifndef SDL_GFX_X#define SDL_GFX_X////////////////SurfaceManip//////////////////SDL_Surface *LoadImage(std::string filename);void DrawRect(int x, int y, int w, int h, int red, int green, int blue, SDL_Surface* destination);void PlaceText(int x, int y, std::string text, TTF_Font *font, SDL_Color textColor, SDL_Surface* destination);void ApplySurface(int x, int y, SDL_Surface* source, SDL_Surface* destination);////////////////////////////////////////////////////////////////FPSCount////////////////////void FPSinit();void FPSmark();std::string FPSget();extern float framespersecond;//////////////////////////////////////////////////////////////////////////////////////////////////////const SDL_Color WHITE = {255,255,255};const SDL_Color BLACK = {0,0,0};const SDL_Color BLUE = {17,43,171};const SDL_Color RED = {195,13,13};const SDL_Color GREEN = {14,158,14};const SDL_Color YELLOW = {231,228,13};const SDL_Color BROWN = {161,139,115};const SDL_Color DARKBROWN = {121,99,75};const SDL_Color GREY = {146,150,147};const SDL_Color DARKGREY = {116,120,117};const SDL_Color PURPLE = {104,15,173};const SDL_Color AQUAMARINE = {12,180,178};#endif

I'm not exactly sure what '__declspec(dllexport)' is, so I wasn't using it. My other dll, SDL_input, doesn't use it either, and it works fine. As far as I can see, the only problem is that SDL_gfx uses SDL_image and SDL_ttf. Is there a special way I'm suppose to include those to the DLL?

##### Share on other sites
Hmm, and I can use the SDL_Colors, just not the functions it seems. It doesn't appear to matter whether a particular function uses SDL_image or SDL_ttf functions, none of the functions work that I've tried.

[Edit:] Okay, it's working now. For others with the same problem, all I did was go to Porject -> Project Options -> Parameters and hit 'Add Library or Object' I then searched through my files and found my dll's object file, called SDL_gfx.o and added that. My final parameters looks like this:
../../../Dev-Cpp/lib/SDL_gfx.o
-SDL_gfx -lSDL_input -lSDL_image -lSDL_ttf
-lmingw32 -lSDLmain -lSDL

I don't understand why I need to link to the object file for SDL_gfx and not SDL_input, but it appears to be working none the less. Hope someone else benifits from this. Many thanks Bregma for your help!

[Edited by - Servant of the Lord on September 18, 2006 12:36:56 PM]

##### Share on other sites
-SDL_gfx should be -lSDL_gfx