Static linked Library Troubles

Started by
1 comment, last by TheNobleOne 18 years, 8 months ago
I am having some trouble with my graphics engine. I chose to do static linked libraries because I don't know how to do dll's in C++. But I am having some trouble anyway. First off i am using Dev-C++ to do this. I have VC++ but I have no clue why I don't use it probably because it is very out of date. Well anyway I want to test my engine outside of my coding test environment. So I decided to try a static linked library. My engine is using SDL for windowing as this might have something to do with it. Step 1. I created a static linked lib project and put in my header file and my cpp file. Step 2. Next I linked the SDL libraries SDLmain and SDL. Step 3. I compiled my library. Now I went to another project and coded up a test app that I know works becuase I tried it in my development setup before hand. Step 4. I linked the sdl libraries to my app because I need them for event handling. Step 5. I linked opengl and glu because I am using them for rendering Step 6. I linked my static library Took me a while just to get it to find my library turns out I had to use the Dev-C++ browser to pic the lib file. Now when I compile it gives a list of linker errors saying it can't find the functions that are defined in SDL. Not the ones for the event loop but the ones my engine is using for windowing. What is going on here? Everything should work fine according to my steps did I do something wrong?
My JournalComputer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter. (Eric Raymond)"C makes it easy to shoot yourself in the foot. C++ makes itharder, but when you do, it blows away your whole leg."-- Bjarne Stroustrup
Advertisement
If you are using static libraries you don't need to link to any external libraries since the end file is simply an archive of the intermediate object files, the linker is never run on them. You will need to link to any libraries used within the static library in the client application, so in your case you only link to the SDL libraries in your test application, not the engine library.
Ok thanks for clearing that up. I decided not to use C++ tho I am going to learn MDX and use C# because I am better in C# anyway. But that is nice to know if the time arises again.
My JournalComputer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter. (Eric Raymond)"C makes it easy to shoot yourself in the foot. C++ makes itharder, but when you do, it blows away your whole leg."-- Bjarne Stroustrup

This topic is closed to new replies.

Advertisement