🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
allegro errors
i get all these errors when i try to compile a very simple allegro program (keep in mind i just started allegro today)
heres the errors
Warning: .drectve `%.*s' unrecognized
main.o(.text+0x99):main.cpp: undefined reference to `_imp__font'
main.o(.text+0xa4):main.cpp: undefined reference to `_imp__screen'
main.o(.text+0xd3):main.cpp: undefined reference to `_imp__font'
main.o(.text+0xde):main.cpp: undefined reference to `_imp__screen'
main.o(.text+0xed):main.cpp: undefined reference to `_imp__key'
C:/Dev-Cpp/lib/liballeg_s.a(wdsound.o)(.text+0x107):wdsound.c: undefined reference to `DirectSoundEnumerateA@8'
C:/Dev-Cpp/lib/liballeg_s.a(wdsound.o)(.text+0x2bc):wdsound.c: undefined reference to `DirectSoundCreate@12'
C:/Dev-Cpp/lib/liballeg_s.a(wdsound.o)(.text+0x37e):wdsound.c: undefined reference to `DirectSoundCreate@12'
C:/Dev-Cpp/lib/liballeg_s.a(wdsndmix.o)(.text+0x3cc):wdsndmix.c: undefined reference to `DirectSoundCreate@12'
C:/Dev-Cpp/lib/liballeg_s.a(wdsndmix.o)(.text+0x475):wdsndmix.c: undefined reference to `DirectSoundCreate@12'
and heres the source
Warning: .drectve `%.*s' unrecognized
main.o(.text+0x99):main.cpp: undefined reference to `_imp__font'
main.o(.text+0xa4):main.cpp: undefined reference to `_imp__screen'
main.o(.text+0xd3):main.cpp: undefined reference to `_imp__font'
main.o(.text+0xde):main.cpp: undefined reference to `_imp__screen'
main.o(.text+0xed):main.cpp: undefined reference to `_imp__key'
C:/Dev-Cpp/lib/liballeg_s.a(wdsound.o)(.text+0x107):wdsound.c: undefined reference to `DirectSoundEnumerateA@8'
C:/Dev-Cpp/lib/liballeg_s.a(wdsound.o)(.text+0x2bc):wdsound.c: undefined reference to `DirectSoundCreate@12'
C:/Dev-Cpp/lib/liballeg_s.a(wdsound.o)(.text+0x37e):wdsound.c: undefined reference to `DirectSoundCreate@12'
C:/Dev-Cpp/lib/liballeg_s.a(wdsndmix.o)(.text+0x3cc):wdsndmix.c: undefined reference to `DirectSoundCreate@12'
C:/Dev-Cpp/lib/liballeg_s.a(wdsndmix.o)(.text+0x475):wdsndmix.c: undefined reference to `DirectSoundCreate@12'
and heres the source
#include <allegro.h>int main() { // Initialize Allegro. allegro_init(); // Set the resolution to 640 by 480 with SAFE autodetection. set_gfx_mode(GFX_SAFE, 640, 480, 0, 0); // Installing the keyboard handler. install_keyboard(); // Printing text to the screen. textout(screen, font, "Hello World!", 1, 1, 10); textout(screen, font, "Press ESCape to quit.", 1, 12, 11); // Looping until the ESCape key is pressed. while(! key[KEY_ESC]) poll_keyboard(); // This shouldn't be necessary in Windows. // Exit program. allegro_exit(); return 0; } // Some Allegro magic to deal with WinMain().END_OF_MAIN();
liballeg_s.a? Isn't that the library you link against for static linking? The file should just be liballeg.a IIRC.
The docs are usually good enough for most of us; between that and the example code that comes with Allegro, you'll pick up the basics in no time. Along with that, there's the Allegro Game Development Network and Pixelate Magazine. But really, most of Allegro is pretty straight-forward, so just try using it and post a new thread if you run into any difficulty. [smile]
the problem is that when i try to do anything other than the basic hello world program i get tons of errors such as
Compiler: Default compilerBuilding Makefile: "C:\Dev-Cpp\Makefile.win"Executing make...make.exe -f "C:\Dev-Cpp\Makefile.win" allg++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++/3.3.1" -I"C:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"C:/Dev-Cpp/include/c++/3.3.1/backward" -I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"C:/Dev-Cpp/include" main.cpp: In function `int _mangled_main()':main.cpp:42: error: syntax error before `;' tokenmain.cpp:44: error: syntax error before `=' tokenmain.cpp:53: error: syntax error before `=' tokenmain.cpp: At global scope:main.cpp:61: error: ISO C++ forbids declaration of `b' with no typemain.cpp:61: error: `i' was not declared in this scopemain.cpp:61: error: `j' was not declared in this scopemain.cpp:63: error: syntax error before `if'main.cpp:66: error: `buffer' was not declared in this scopemain.cpp:66: error: `i' was not declared in this scopemain.cpp:66: error: `j' was not declared in this scopemain.cpp:66: error: `r' was not declared in this scopemain.cpp:66: error: `g' was not declared in this scopemain.cpp:66: error: ISO C++ forbids declaration of `putpixel' with no typemain.cpp:66: error: `int putpixel' redeclared as different kind of symbolC:/Dev-Cpp/include/allegro/inline/draw.inl:43: error: previous declaration of ` void putpixel(BITMAP*, int, int, int)'main.cpp:66: error: initializer list being treated as compound expressionmain.cpp:67: error: syntax error before `}' tokenmain.cpp:71: error: `bitmap' was not declared in this scopemain.cpp:71: error: ISO C++ forbids declaration of `circlefill' with no typemain.cpp:71: error: `int circlefill' redeclared as different kind of symbolC:/Dev-Cpp/include/allegro/draw.h:46: error: previous declaration of `void circlefill(BITMAP*, int, int, int, int)'main.cpp:71: error: initializer list being treated as compound expressionmain.cpp:74: error: `bitmap' was not declared in this scopemain.cpp:74: error: ISO C++ forbids declaration of `circlefill' with no typemain.cpp:74: error: redefinition of `int circlefill'main.cpp:71: error: `int circlefill' previously defined heremain.cpp:74: error: initializer list being treated as compound expressionmain.cpp:76: error: syntax error before `while'main.cpp:83: error: ISO C++ forbids declaration of `x' with no typemain.cpp:83: error: ISO C++ forbids declaration of `y' with no typemain.cpp:85: error: `buffer' was not declared in this scopemain.cpp:85: error: `behind' was not declared in this scopemain.cpp:85: error: ISO C++ forbids declaration of `blit' with no typemain.cpp:85: error: `int blit' redeclared as different kind of symbolC:/Dev-Cpp/include/allegro/draw.h:55: error: previous declaration of `void blit(BITMAP*, BITMAP*, int, int, int, int, int, int)'main.cpp:85: error: initializer list being treated as compound expressionmain.cpp:87: error: `buffer' was not declared in this scopemain.cpp:87: error: `bitmap' was not declared in this scopemain.cpp:87: error: ISO C++ forbids declaration of `draw_sprite' with no typemain.cpp:87: error: `int draw_sprite' redeclared as different kind of symbolC:/Dev-Cpp/include/allegro/inline/draw.inl:90: error: previous declaration of ` void draw_sprite(BITMAP*, BITMAP*, int, int)'main.cpp:87: error: initializer list being treated as compound expressionmain.cpp:89: error: `buffer' was not declared in this scopemain.cpp:89: error: ISO C++ forbids declaration of `blit' with no typemain.cpp:89: error: redefinition of `int blit'main.cpp:85: error: `int blit' previously defined heremain.cpp:89: error: initializer list being treated as compound expressionmain.cpp:91: error: `behind' was not declared in this scopemain.cpp:91: error: `buffer' was not declared in this scopemain.cpp:91: error: ISO C++ forbids declaration of `blit' with no typemain.cpp:91: error: redefinition of `int blit'main.cpp:89: error: `int blit' previously defined heremain.cpp:91: error: initializer list being treated as compound expressionmain.cpp:92: error: ISO C++ forbids declaration of `release_screen' with no typemain.cpp:92: error: new declaration `int release_screen()'C:/Dev-Cpp/include/allegro/inline/gfx.inl:206: error: ambiguates old declaration `void release_screen()'main.cpp:95: error: syntax error before `if'main.cpp:98: error: `bitmap' was not declared in this scopemain.cpp:98: error: ISO C++ forbids declaration of `destroy_bitmap' with no typemain.cpp:98: error: `int destroy_bitmap' redeclared as different kind of symbolC:/Dev-Cpp/include/allegro/gfx.h:361: error: previous declaration of `void destroy_bitmap(BITMAP*)'main.cpp:99: error: `behind' was not declared in this scopemain.cpp:99: error: ISO C++ forbids declaration of `destroy_bitmap' with no typemain.cpp:99: error: redefinition of `int destroy_bitmap'main.cpp:98: error: `int destroy_bitmap' previously defined heremain.cpp:100: error: `buffer' was not declared in this scopemain.cpp:100: error: ISO C++ forbids declaration of `destroy_bitmap' with no typemain.cpp:100: error: redefinition of `int destroy_bitmap'main.cpp:99: error: `int destroy_bitmap' previously defined heremain.cpp:102: error: syntax error before `return'main.cpp: In function `int WinMain(void*, void*, char*, int)':main.cpp:107: error: redefinition of `int WinMain(void*, void*, char*, int)'main.cpp:104: error: `int WinMain(void*, void*, char*, int)' previously defined heremain.cpp:107: error: redefinition of `int WinMain(void*, void*, char*, int)'main.cpp:104: error: `int WinMain(void*, void*, char*, int)' previously defined heremain.cpp: At global scope:main.cpp:92: warning: inline function `int release_screen()' used but never definedmake.exe: *** [main.o] Error 1Execution terminated
and another thing is that how come all the examples are .c files can you only use allegro with c??
Allegro works with C++ just fine. Your errors seem to be related to syntax problems - post the code that isn't working.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement