[Allegro, C++] Błąd: 'undefined reference to `WinMain@16''
Ostatnio zmodyfikowano 2010-08-09 00:08
Animax97 Temat założony przez niniejszego użytkownika |
» 2010-08-08 23:46:53 @UP Przy dołączaniu tych linkerów wywala mi błędy, ale ta druga metoda skompilowała mi kod poprawnie... Ale teraz gdy kompiluje ten mój kod: #include <allegro.h> #include <winalleg.h> #include <windows.h>
int main() { allegro_init(); allegro_exit(); return 0; } END_OF_MAIN();
Pojawia się błąd: -------------- Build: Debug in Allegro ---------------
Compiling: main.cpp Linking console executable: bin\Debug\Allegro.exe obj\Debug\main.o: In function `Z13_mangled_mainv': D:/C++/Allegro/main.cpp:7: undefined reference to `_install_allegro_version_check' D:/C++/Allegro/main.cpp:8: undefined reference to `allegro_exit' obj\Debug\main.o: In function `WinMain@16': D:/C++/Allegro/main.cpp:11: undefined reference to `_WinMain' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 3 errors, 0 warnings
Nawet gdy zmienie main() to nic nie daje... //edit Tzn. jak dam tak: #include <allegro.h> #include <winalleg.h> #include <windows.h>
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) { allegro_init(); allegro_exit(); return 0; } END_OF_MAIN();
to wtedy mam takie błędy: -------------- Build: Debug in Allegro ---------------
Compiling: main.cpp D:\C++\Allegro\main.cpp: In function 'int WinMain(void*, void*, char*, int)': D:\C++\Allegro\main.cpp:11: error: redefinition of 'int WinMain(void*, void*, char*, int)' D:\C++\Allegro\main.cpp:5: error: 'int WinMain(void*, void*, char*, int)' previously defined here D:\C++\Allegro\main.cpp:11: error: '_mangled_main' was not declared in this scope Process terminated with status 1 (0 minutes, 0 seconds) 3 errors, 0 warnings
|
|
ison |
» 2010-08-09 00:00:57 jeśli mówisz że przy tych: -lalleg_s -lgdi32 -ldxguid -lole32 -ldinput -lddraw -lwinmm -ldsound
linkerach wywala ci błąd to mi się zdaje że źle zainstalowałeś allegro u mnie ten kod #include <allegro.h> #include <winalleg.h> #include <windows.h>
int main() { allegro_init(); allegro_exit(); return 0; } END_OF_MAIN();
po dołączeniu wyżej wymienionych linkerów i niczego poza nimi dobrze się kompiluje |
|
Animax97 Temat założony przez niniejszego użytkownika |
» 2010-08-09 00:08:41 A u mnie błąd:
-------------- Build: Debug in Alle ---------------
Linking console executable: bin\Debug\Alle.exe c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -l-lalleg_s collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings
A może mam zła bibliotekę? Podaj link do downloadu do tej którą ty masz ... Bo teoretycznie wszystko powinno działać ;[ //edit Chyba znalazłem przyczynę... Poczekaj chwilkę dam edita... //edit2 Chyba to od tego, że zamiast linkery dać do: Other linker options, to dałem do: Link libraries... Zobaczę, jeszcze jak będzie z innymi kodami... //edit3 Ok. Działa ;) Thx za pomoc ison (znowu :p) |
|
1 « 2 » |