SDL init undefined reference
Hi
I have started to use kdevelop4 (3.9.91) on my ne slackware64 13 Desktop. I was developing software which uses SDL in earlier version of slackware 12.2. (I don't know which version of kdevelop). Now I tried use the same code in kdevelop4 and at build time I get an undefined reference for SDL_Init function. It gives no sense because in #include SDL/SDL.h I can see that SDL_Init function is included. The export of code stands for me in copy the .cpp source of the main function into newly created c++ project in kdevelop4. I get lot more undefined reference messages for 26 SDL functions which I can locate in included header files. I noticed that the SDL headers library changed a little and now I have lots of header files like SDL_video.h, SDL_config.h, SDL_main.h. There are 36 header files for SDL in the /usr/include/SDL folder. May it be that the old header file SDL.h have included everything in one and I need to Include more header files? These is the list of existing header files in /usr/include/SDL/: Quote:
Quote:
|
Hi,
I'm a new commer in Linux Graphics Programming field. Please may i know how can you get exactly enough 36 headers like that in SDL directory . For my case i always missed the header SDL_image.h . I have tried to reinstall SDL_image-1.2.3.rpm and later SDL_image-1.2.7.rpm . For 1.2.3 it show no error but the header SDL_image.h still missing. And for 1.2.7-1 there are 2 dependencies failures : Libc.so.6 is missing and RTLD is missing. Can anyone suggest me a solution please. I sincerely apologize if my post has created any inconvinience. And i hope to hear a reply soon. Your sincerely Andrew. |
I have the new slackware 13 distribution. It uses the package SDL 1.2.13. The main question is what linux distribution you are using? The version 13 of slackware is very new. (released 27.8.) I cannot help you with managing the new version of SDL package into your distribution. The only solution I know - install slack 13.;)
But as you can see it is possible that there are still some problems with it. Because the code I am using for my graphic application was running with no problem in previous version of slackware (12.2) Regards Zoltan |
An undefined reference is a linking issue, not a header issue. Check that you have the proper linking information for your libraries.
hth Mike |
Thanks for your reply.
Quote:
|
Quote:
|
Each distribution uses its own packaging system. If you cannot find the package for your distribution you have to take care about it yourself. (create a package from source or compile the source (usually C++ code) right into your distribution)
Since I have no experience with Red Hat linux I cannot guide you to implement a new version of SDL into it. There can be other dependencies which I do not know about. I can only guide you to use slackware. You can get it here: http://www.slackware.com/getslack/torrents.php Its a torrent iso - you can choose weather you use CDs or DVD, 32 bit or 64 bit. But before this you need to know slackware is different and you need to learn the basic install process. (From my point of view its very simple, because I already walk through the install several times) If you decide to setup slackware you have to be prepared to solve possible "difficulties". I can help you with that. I cannot tell you how difficult would be the other way - implementing the new SDL version into redhat. You have to decide yourself. If you decide to try slackware - create a thread in linuxdistros > slackware > Newbie slackware user - install. I will find your post and guide you there. There are lots of helpful guys (and girls) who will be happy to help out a newbie slackware users. Good luck |
The gcc info page will have much more info, but basically you want to do
gcc -lSDL -o sdl_program sdl_program.c or something similar depending on how your project is set up. The -L option may also be of interest to you (read the info page for that one). |
Quote:
gcc -o sdl_program sdl_program.c -lSDL because your program generates references to libSDL.so You might be interested in http://lazyfoo.net/SDL_tutorials/index.php It shows how to set up SDL with various systems, including KDevelop. |
Quote:
I have used SDL exactly the way how it is showed on the link above before kdevelop version 3.9.91. I start a new project wizard which gives me the option of the simple SDL program. Probably this step makes everything for me what is needed for SDL library linking. But now when I am creating a new project in kdevelop4 I cannot choose simple SDL program. It has very few project templates. So all the steps what the old kdevelop done for me in previous versions I need to do on my own. But how?? Quote:
I would like to done this the way that my kdevelop build the executable directly from the kdevelop application. I was using build from the project menu. I get this error: Quote:
|
Quote:
The command gcc -o sdl_program sdl_program.cpp -lSDL compiles your program and creates references to the libSDL.so library. If you prefer to have sdl linked in you'd add a -static directive. It would then load the referenced functions from libSDL.a directly into your program. Usually this would be found in your Makefile. Mike |
Quote:
Kevin Barry |
All times are GMT -5. The time now is 11:30 PM. |