SDL_gfx
Well, to use C++ you will have to learn how to link the libraries you are using. The `sdl-config --libs` part links the normal SDL libraries, you can see what it does by running the script by itself. On my system it is;
$>sdl-config --libs
-L/usr/lib -lSDL -lpthread
Learn what these flags do. -L for showing the path to what you want to link, -l for linking the compiled library binary to your program. On my system they are named like libSDL.a, libSDL_gfx.a . -lSDL links libSDL.a for example. /usr/lib is generally the place on my system where most compiled and archived libraries go. So what you need to add is a -lSDL_gfx at the end of your compilation/linking line.
Just including the header of a library does not work, unless all the definitions are inside that header. Sometimes this is the case. Most of the time, not. Learn what a declaration and definition is and why/how they are separated.
You might ask; why does, for example, just #include <iostream> let me use the std::cin, std::cout objects without visibly linking anything even though definitions are not in that header or in anywhere which it #includes? the answer is, they already get linked when you invoke g++. The library's name is libstdc++.a or similar on my system. A call to g++ links it automatically. If you want to demonstrate, you can also try to link it manually and use gcc itself. But g++ does a few more things. So it is pointless to use gcc and repeat what g++ readily does.
Read some Makefile s and learn to write your own, and you'll get better used to this.
PS: I had a problem using functionColor style functions in SDL_gfx, I never asked anyone, but when I used the functionRGBA style functions I got results, so I started using those instead.
I realize I am quite late but I hope someone else reads and makes use of this.
Happy coding.
Last edited by EPITAPH-XV; 11-04-2004 at 05:40 AM.
|