Problem mit allegro

Windhund

Mitglied
Hallo

Ich versuche seid ca. 2 wochen allegro unter Ubuntu 8.04 mit der Prrogrammierumgebung Codeblocks zum laufen zu bringen.

Das problem ist die meisten anleitungen die ich finde sind für Dev C++ unter Windows.
Da ich Linux User bin habe ich natürlich kein Windows und auch kein DevC++ .

Ich hab mich schon schrit für schrit durch mehrere probleme durchgekämpft, aber jetzt steh ich leider vor einem wo ich einfach keine lösung zu finde.

Zum testen habe ich mir einen einfachen code aus dem Internet geholt:
Code:
#include <allegro.h>
#include <linalleg.h>
int main(){

    allegro_init();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);

    while(key[KEY_ESC]==0);

    return 0;
}
END_OF_MAIN();

Ich habe die liballeg.a aus dem Verzeichnis /usr/lib in das Projekt eingebunden und bekomme folgenden fehlerlog:
Code:
/usr/lib/liballeg.a(xsystem.o)||In function `_xwin_sysdrv_init':|
(.text+0x667)||undefined reference to `XInitThreads'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_redraw_window':|
(.text+0x92d6)||undefined reference to `XShmPutImage'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_redraw_window':|
(.text+0x9314)||undefined reference to `XPutImage'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_redraw_window':|
(.text+0x9351)||undefined reference to `XFillRectangle'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_set_window_defaults':|
(.text+0x9394)||undefined reference to `XStoreName'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_set_window_defaults':|
(.text+0x93bf)||undefined reference to `XSetClassHint'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_set_window_defaults':|
(.text+0x9410)||undefined reference to `XpmCreatePixmapFromData'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_set_window_defaults':|
(.text+0x9428)||undefined reference to `XSetWMHints'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x9464)||undefined reference to `XUndefineCursor'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x9482)||undefined reference to `XcursorImageDestroy'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x94a1)||undefined reference to `XCreatePixmap'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x94d6)||undefined reference to `XCreateGC'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x94eb)||undefined reference to `XDrawPoint'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x94f7)||undefined reference to `XFreeGC'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x953f)||undefined reference to `XCreatePixmapCursor'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x9552)||undefined reference to `XDefineCursor'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x955d)||undefined reference to `XFreePixmap'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x957a)||undefined reference to `XCreateFontCursor'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x958d)||undefined reference to `XDefineCursor'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_hide_x_mouse':|
(.text+0x95a7)||undefined reference to `XFreeCursor'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x95fc)||undefined reference to `XBlackPixel'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x9611)||undefined reference to `XBlackPixel'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x962c)||undefined reference to `XDefaultRootWindow'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x9658)||undefined reference to `XCreateWindow'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x966f)||undefined reference to `XGetWindowAttributes'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x96ae)||undefined reference to `XCreateColormap'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x96c7)||undefined reference to `XSetWindowColormap'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x96d5)||undefined reference to `XInstallColormap'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x970a)||undefined reference to `XCreateWindow'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x9719)||undefined reference to `XMapWindow'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x972d)||undefined reference to `XInternAtom'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x974b)||undefined reference to `XSetWMProtocols'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x9796)||undefined reference to `XCreateGC'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_create_window':|
(.text+0x97a7)||undefined reference to `XcursorSupportsARGB'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_display_is_local':|
(.text+0x9936)||undefined reference to `XDisplayName'|
/usr/lib/liballeg.a(xwin.o)||In function `free_modelines':|
(.text+0x99bd)||undefined reference to `XFree'|
/usr/lib/liballeg.a(xwin.o)||In function `free_modelines':|
(.text+0x9a13)||undefined reference to `XFree'|
/usr/lib/liballeg.a(xwin.o)||In function `free_modelines':|
(.text+0x9a32)||undefined reference to `XFree'|
/usr/lib/liballeg.a(xwin.o)||In function `free_modelines':|
(.text+0x9a4d)||undefined reference to `XFree'|
/usr/lib/liballeg.a(xwin.o)||In function `free_modelines':|
(.text+0x9a68)||undefined reference to `XFree'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_fetch_mode_list':|
(.text+0x9e7f)||undefined reference to `XF86VidModeQueryExtension'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_fetch_mode_list':|
(.text+0x9e9e)||undefined reference to `XF86VidModeQueryVersion'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_fetch_mode_list':|
(.text+0x9ec0)||undefined reference to `XF86VidModeGetAllModeLines'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_get_pointer_mapping':|
(.text+0x9f88)||undefined reference to `XGetPointerMapping'|
/usr/lib/liballeg.a(xwin.o)||In function `xwin_set_window_name':|
(.text+0xa0d3)||undefined reference to `XSetClassHint'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_set_window_title':|
(.text+0xa17d)||undefined reference to `XStoreName'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_flush_buffers':|
(.text+0xa332)||undefined reference to `XSync'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_enable_hardware_cursor':|
(.text+0xa4dd)||undefined reference to `XWarpPointer'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_handle_input':|
(.text+0xa5bb)||undefined reference to `XWarpPointer'|
/usr/lib/liballeg.a(xwin.o)||In function `_xwin_private_handle_input':|
(.text+0xa5d5)||undefined reference to `XEventsQueued'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Habt ihr vieleicht eine Idee woran das liegen könnte?
Währe für jede Hilfe dankbar.
 
Hi.

Warum machst du es dir so schwer? Du kannst doch Allegro einfach über apt als deb Paket installieren:
Code:
sudo apt-get install liballegro4.2-dev
Dann werden auch alle notwendigen anderen Bibliotheken installiert.

Außerdem wird das Skript allegro-config (:rtfm: man allegro-config) installiert, welches du mit der Option --cflags aufrufst um die notwendigen C Compilerflags zu erfahren, und mit der Option --libs um die notwendigen Flags für den Linker zu erfahren.

Die Flags für den Compiler trägst du dann unter "Andere Optionen" und entsprechend für den Linker unter Linker Einstellungen ebenfalls in den Projekteinstellungen ein. Fertig.

Gruß
 
Zurück