|
Noobs guide to installing allegro 5 in MinGW |
Levi Harman
Member #14,335
May 2012
|
Noobs guide to installing Allegro with Mingw on windows 7. For this guide I am using mingw Here is a link to the official guide to installing mingw, I only suggest looking at it if I forget to mention something. You might want to read over it but I plan on mentioning everything in this post. After you install mingw-get-inst-"version number" (I am using mingw-get-inst-20120426) run the .exe and click next until you get to Repository Catalogues. Check the 'Use pre-packaged repository catalogues' then click next. Accept the agreement. I recomend installing to C:\MinGW Okay so now you are done with mingw setup. In order to open mingw open the start menu and search mingw, however do not drag the mingw file to desktop or anywhere else. This will break the program. If you want to open mingw search mingw in the start menu every time. If you know of a way to make a shortcut without breaking the program then let me know. Next go to allegro.cc/files/ and if you downloaded mingw-get-inst-20120426 like me you will have MinGW 4.6.2 . Download MinGW 4.6.2 zip and extract the folder to your computer using winrar, izarc, or 7zip. Congratulations the library is successfully installed! Here is a hello world program for allegro. (I got this hello world program from this persons website. I recommend going through all of his 2d game dev tutorials, they all compile using minGW even though he uses Microsoft visual studio 2010. http://fixbyproximity.com/2011/07/2d-game-dev-your-first-allegro-5-program/) #include <allegro5\allegro.h> int main(void) if(!al_init()) al_destroy_display(display); return 0; Make a folder in your c: directory called workspace, In that folder make another folder called allegro_hello, in that folder make a file called allegro_hello.cpp and copy the above source code into that file. Start minGW. In order to go to c: drive type cd c: into the shell(command prompt). Now type cd workspace to get to your minGW workspace folder. Now type cd allegro_hello to get to your project folder. You may now type dir in order to view contents of the folder (there should be a file called allegro_hello.cpp) Now you will compile your program. Here is a command you will use to compile your allegro programs with c++ (There will be 3 warnings but you can ignore this since this is only an example program.) Congratulations allegro is now set up correctly and you can program games or follow tutorials! Any questions can be posted in the thread! |
weapon_S
Member #7,859
October 2006
|
Levi Harman said: MSYS Basic System That's not necessary. Quote: If you know of a way to make a shortcut without breaking the program then let me know. I have this batch file. [1] This also removes the necessity to let MinGW "alter your system" i.e. add a path globally. You should make a shortcut to the batch file, not copy it. @ECHO OFF IF EXIST "%1" ( ECHO Passing a file to this script screws up the current working directory. ECHO Aborting. PAUSE GOTO end ) SET PATH=%CD%\C\MINGW\BIN;%PATH%; SET MINGDIR=%CD%\C\MINGW %windir%\system32\cmd.exe :end @ECHO ON
Any newbie who isn't afraid of a bigger challenge, I'd recommend to download Allegro's source and build it yourself, using the included help files. (You'll need to install CMAKE first...) This will give you the documentation, example programs, demo's with source, and of course Allegro's source. Especially the first two can be very handy to newbies. Although it will spice up linking a bit... References
|
Karadoc ~~
Member #2,749
September 2002
|
I highly recommend getting minGW from here rather than from the minGW website. The distro I linked to always has the most up-to-date version, and includes some other useful libraries, such as Boost. And it also includes a batch file similar to the one weapon_S posted. The only disadvantage is that the gcc version on that site is often ahead of latest version used for the prebuilt allegro binaries; so you have to compile allegro yourself. (For example, http://www.allegro.cc/files/ currently has 4.6.2 as the latest version of minGW; but nuwen.net currently has minGW v4.7.0.) ----------- |
|