Original Post
Hi,
I''m just new to Linux programming and tried to make a little "game" with SDL. I use KDevelop and entered the following little code:
This compiles, but I can''t link it.
I get: undefined reference to ''SDL_Init''. Then I thought. I probably have to add some lib somewhere. So I found you could set the project properties. I typed in the lib path of SDL: /usr/lib/libSDL.so. I don''t know if this is the right one, but when I link now it gives the following undefined references: ''pthread_create'', ''pthread_cancel'', ''sem_destroy'', ''sem_wait'', ... and a lot more (pthread_* and sem_*).
Do I need to include other libs? I''ve installed both the development and binary runtime of SDL.
Any help would be appreciated.
Btw, I''ve also tried to link in the console with ld, but it gave the same troubles.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "SDL.h"
#include <iostream.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
cout << "Unable to initialize SDL.\n";
cout << "Reason: " << SDL_GetError();
exit(1);
}
atexit(SDL_Quit);
cout << "Initialization succeeded!!";
return 0;
}
|