======================================= =============== Using Allegro =============== =======================================
All the Allegro functions, variables, and data structures are defined in allegro.h. You should include this in your programs, and link with either the optimised library liballeg.a, the debugging library liballd.a, or the profiling library liballp.a. You should include the Allegro DLLs in any software you release to the public.
When using a statically linked library, you must define the preprocessor symbol ALLEGRO_STATICLINK before including any of the Allegro headers and link your program against Allegro and the main Win32/DirectX libraries in that order (see the variable LIBRARIES in makefile.mgw).
Don't forget that you need to use the END_OF_MAIN() macro right after your main() function.
=======================================
A simple example of a command line to compile an allegro program with MingW32:
gcc foo.c -mwindows -O2 -Wall -o foo.exe -lalleg
=======================================
A simple example on how to create a little program with Dev-C++:
Launch Dev-C++ and create a new project (File/New Project). Select "Windows Application", then click on the "Ok" button. Name your project and give associate it to a new file. You should now see a sample code in a window. Close that window since you won't be needing it (Allegro is much simpler to use than this). Create a new file (File/New Source File), then write a small Allegro program. You can inspire yourself by the Allegro examples if you wish. Here's a small program you can type to see if everything worked until now:
#include <allegro.h>
int main() { allegro_init(); allegro_message("Hello World!"); return 0; } END_OF_MAIN();
You now need to tell Dev-C++ that you'd like to make a program that uses Allegro. For that, go in the Project Options screen (Project/Project Options menu), then enter -lalleg (or -lalld for the debug mode) in the box under 'Further object file or linker options'.
Compile your project! Simply click on the green check mark on your Dev-C++ toolbar. Correct any syntax errors in your code, then click on "Execute" to run the program. If all worked you will see a message box pop up with "Hello World" inside of it.
Happy coding!
Kan det have noget at gøre med at jeg skal skrive '-lalleg' et sted? :)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.