Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Servermaster Servermaster is offline
Member Aktif
 
Join Date: Nov 2011
Posts: 257
Rep Power: 14
Servermaster mempunyai hidup yang Normal
Default [ask] Nubitol tanya tentang compile SDL C++

permisi agan2..

ane mau tanya nih, walo bukan projremer, ane sok-sokan pengen belajar C++. sekarang lagi belajar SDL.

kebetulan di linux ane sudah ada SDL (versi 1.2.14)

nah, ane coba kompilasi contoh program dari tutorialnya seperti ini:


Code:


#include "SDL/SDL.h" /* All SDL App's need this */
#include

int main(int argc, char *argv[]) {

printf("Initializing SDL.\n");

/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
}

printf("SDL initialized.\n");

printf("Quiting SDL.\n");

/* Shutdown all subsystems */
SDL_Quit();

printf("Quiting....\n");

exit(0);
}

ternyata pas dikompilasi lewat eclipse, error


Spoiler for errornya:







Code:

**** Build of configuration Debug for project cppdummies ****

make all
Building target: cppdummies
Invoking: GCC C++ Linker
g++ -o"cppdummies" ./src/blajarSDL.o: In function `main':
/home/Data/programming/eclipse/cppdummies/Debug/../src/blajarSDL.cpp:16: undefined reference to `SDL_Init'
/home/Data/programming/eclipse/cppdummies/Debug/../src/blajarSDL.cpp:17: undefined reference to `SDL_GetError'
/home/Data/programming/eclipse/cppdummies/Debug/../src/blajarSDL.cpp:26: undefined reference to `SDL_Quit'
collect2: ld returned 1 exit status
make: *** [cppdummies] Error 1









ane coba cara ini, ternyata error juga


Code:

$ g++ namafilenyaSDL.cpp 'sdl-config --cflags --libs' -o sdltest
g++: sdl-config --cflags --libs: No such file or directory

oya, ane udah beberapa kali googling, ternyata ada yang pernah nanya hal yang sama (5 thn lalu) tapi blom ada jawabannya



makasih mastah-mastah semua

ditunggu jawaban atau petunjuknya



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 03:15 AM.


no new posts