![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
Installing and Using Allegro 5 with code::blocks |
the_get_man
Member #13,909
January 2012
|
I really need help installing Allegro 5. I am using code::blocks and I can not figure it out. Yes I have tried the wiki and everything else but still no success. I found a good step by step instruction manual for how to install allegro5 to c::b on this site. The url is: http://www.allegro.cc/forums/thread/606041 I am going to explain the steps I have take so far in respect to the above instructions: Steps 1-4: Success Step 5: I already had code::blocks (10.05) installed on my computer because I have been coding with it for quit a while so instead of the directory C:\codeblocks which the instructions say to install it in my directory is C:\Program Files (x86)\CodeBlocks. All parts of the instructions that ask for the the CodeBlocks directory have include the file path C:\Program Files (x86)\ Step 6: I added the code ;C:\Program Files (x86)\codeblocks\mingw\bin; to the end of what was already in the path system variable. It looks like this now: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\CodeBlocks\MinGW\bin; Step 7: Success looks like this (Variable): MINGDIR (Value): C:\Program Files (x86)\CodeBlocks\mingw /* Do capital letters in these paths matter or have any effect at all because my mingw folder is titled MinGW*\ Step 8: Success I copied the "lib" and "include" folder directly to C:\Program Files (x86)\CodeBlocks\mingw directory Step 9: Success I copied "Allegro" to C:\Program Files (x86)\CodeBlocks\mingw directory Step 10: Success I installed"cmake-2.8.3-win32-x86.exe" to "C:\cmake" and I was sure to select the option to "Add CMAKE to the system path for the current user". Step 11: Success I created a folder named build in the directory C:\Program Files (x86)\CodeBlocks\mingw\allegro directory Step 12: This is the step that fails and I am stuck on. I run cmd. -I move on and type "cd C:\Program Files (x86)\codeblocks\mingw\allegro\build" without quotes and press enter. Now the command display looks like this: C:\Program Files (x86)\codeblocks\mingw\allegro\build> - I type (cmake .. -G "MinGW Makefiles") without parantheticals and press enter. The error is displayed: 'cmake..' is not recognized as an internal or external command, operable program or batch file. I dont know what I did wrong and I can't reply to the tread that I got the steps from because it is locked. Please help. oh and also I am assuming allegro 5.0.0 rc4 is just the same allegro used to create 2d video games. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
It says cmake wasn't found. That's because it's not on your path. Have you installed cmake? When you do there should be an option to add it to your path. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AMCerasoli
Member #11,955
May 2010
![]() |
the_get_man said: Yes I have tried the wiki and everything else but still no success. I found a good step by step instruction manual for how to install allegro5 to c::b on this site. Hi there, I would really like, if you have the time, to tell us the problem you found using the wiki tutorial about building Allegro 5. You say you want to install Allegro, but you're reading tutorials about building it. If you're on Windows you can use the pre-complied binaries to skip the building process and save your time. Also I hope you have noticed this sentence in the tutorial you're reading: "Some "Not Found" and "Failed" messages should be okay. They appear because it didn't find additional libraries that are not required." He said they're not required but at least you don't need, Audio or Fonts (among others) those libraries are required.
|
Emanresu
Member #12,510
January 2011
|
Like Edgar said, you need cmake. It isn't installed with Code::Blocks at all. It is a stand alone program that you can run from the command line. Or you can run the GUI, which is what I recommend. "* Entoutcas has quit IRC (Quit: And the Lord said unto John; Come forth and receive eternal life. But John came fifth and won a toaster...)" |
the_get_man
Member #13,909
January 2012
|
Edgar Reynaldo: Yes in step 10 I installed cmake and added cmake to the system path for the current user. In the Environment Variables > User variables there was variable called PATH with the value C:\cmake. AMCerasoli: Here is the wiki site I tried http://wiki.allegro.cc/index.php?title=Windows_Vista,_Code::Blocks_10.05_and_Allegro_5 I already had installed codeblocks 10.05 mingw setup. I went to the wiki installed Mingw which is says to do first then I downloaded the Allgro.cc/files it says to download. I unzip the folder to my desk top and in the "lib" folder I delete all the files that dont have "-static-mt". Not at one point so far has an allegro installer or .exe popped up In code blocks I go to the linker setting like the wiki suggests and I add the "lib" files that are in it then I check my MinGW file to make sure the libraries are in there and manually add each on to to the linker in code blocks. Then I add: Then in the search directories direction that follows I dont have an c:\allegro directory like the directions state so Im stuck there on the wiki. I found the steps on allegro.cc and decided to use those instead so I uninstalled everything and tried again. also if I did ever get the thing ready for use the wiki says that you have to use: when coding with Allegro which I wasn't sure if the etc.. ment etc.. or if it was actually needed as part of the code. I just need this thing installed so I can figure out how to start using it. I am going to unistall everything and start back from square one. One more question will this code work on allegro 5 with codeblocks #include <allegro.h> int main(){ allegro_init(); install_keyboard(); set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0); readkey(); return 0; } END_OF_MAIN();
|
Emanresu
Member #12,510
January 2011
|
the_get_man said: Edgar Reynaldo: Yes in step 10 I installed cmake and added cmake to the system path for the current user. In the Environment Variables > User variables there was variable called PATH with the value C:\cmake. That could be your problem if you didn't set the path up for all users and you used two profiles........ Although if you used your user account to set the path up, then it should be fine. I recommend copying the cmake executable to the directory you're in on the command line, or using cmake-gui. I think you can get the gui if you just run cmake without any options. [EDIT] "* Entoutcas has quit IRC (Quit: And the Lord said unto John; Come forth and receive eternal life. But John came fifth and won a toaster...)" |
Matthew Leverton
Supreme Loser
January 1999
![]() |
the_get_man said: One more question will this code work on allegro 5 with codeblocks No. That is the Allegro 4 API. Allegro 5 is completely different. |
AMCerasoli
Member #11,955
May 2010
![]() |
the_get_man said: Here is the wiki site I tried http://wiki.allegro.cc/index.php?title=Windows_Vista,_Code::Blocks_10.05_and_Allegro_5 The problem is that you're a little bit confused. That link is about installing Allegro, and the one you're reading here in Allegro.cc is about building it. Since you are beginning, I would strongly recommend you to use the pre-compiled binaries instead of building Allegro by yourself. Quote: Then in the search directories direction that follows I dont have an c:\allegro directory like the directions state so Im stuck there on the wiki. Man, the images are for reference only... Go to the folder you saved the binaries and use that instead. Could be in C:,\ D:\ or F:\... the folder may have any name you want, just use that, it'll work. Quote: when coding with Allegro which I wasn't sure if the etc.. ment etc.. or if it was actually needed as part of the code. For Christ's sake, the etc, it is just that, an etc..., it means that the 'includes' listed there are not the complete list... There are other Allegro 'includes' you can use. Besides sometimes you don't need to include them all if you're not going to use it, for that reason there is an etc... In C/C++ an "etc..." include doesn't exist. Quote: Tell me what steps you would take or have taken so I can do the same please include links and anything else that will help me. Then give me source code I can use to test the install. Take a deep breath an follow the Wiki, believe me, it's your best choice.
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
the_get_man said: The error is displayed: 'cmake..' is not recognized The '..' is a separate argument indicating the path to the location of the cmake build files. You have to have a space there. MinGW doesn't work well when installed to a path with spaces in it. the_get_man said: Then in the search directories direction that follows I dont have an c:\allegro directory like the directions state so Im stuck there on the wiki. c:\allegro is symbolic of where you unzipped the zip file containing the allegro binaries... Follow this, and start over at the beginning. Note : You can safely ignore the part where it says to delete some of the libraries. It only says that because it assumes you want to static link, which is a poor assumption. If you know the difference between static and dynamic linking and which libraries are which, you should be fine. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
the_get_man
Member #13,909
January 2012
|
Okay so I did everything from the beginning I ignored the part where it says to delete some of the libraries and linked it dynamically. I don't know the difference between the two beside that in this case dynamic linking is easier and located in the "bin" folder instead of the "lib" folder. I did exactly as the directions say and linked all and only the files that ended with "-md.dll" not anything else for example "-md-debug.dll". There was a total of 12 files that ended in "-md.dll" Now I have never coded with allegro 5 but Here is the code I used to test the installation which I found on the internet. If everything works the black box should go and come real quick and if something doesn't work it will tell you what might be wrong: 1#include <allegro5\allegro.h>
2#include<allegro5\allegro_native_dialog.h>
3
4int main(void)
5{
6 ALLEGRO_DISPLAY *display = NULL;
7
8 if (!al_init())
9 {
10 al_show_native_message_box(NULL, NULL, NULL,
11 "failed to initialize allegro!", NULL, NULL);
12 return -1;
13 }
14
15 display = al_create_display(640, 480);
16
17 if(!display)
18 {
19 al_show_native_message_box(NULL, NULL, NULL,
20 "failed to initialize display!", NULL, NULL);
21 return -1;
22 }
23
24 al_destroy_display(display);
25
26 return 0;
27}
The code compiles with 0 errors/ 2 warnings but when I run I get this error: "The program can't start because allegro-5.0.5-monolith-md.dll is missing from your computer. Try reinstalling the program to fix this problem" I went back to build options > linker settings and made sure that exact file path was in the link libraries and it is. So this is were I am stuck now |
Matthew Leverton
Supreme Loser
January 1999
![]() |
It doesn't know where to find the DLLs. Go to Settings/Environment/Environment Variables and add one that looks like: Key: PATH Change the name of the folder accordingly. Alternatively you could:
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Matthew Leverton said:
Key: PATH Ehhh... Don't do that, it will take the value of %PATH% literally. Just insert the path to the dll's followed by a semicolon before the rest of the current value. If you were doing it from the command line, you would use : set path=c:\allegro\bin;%PATH% OR, you can just copy the dll's you need to the folder with the binary (your program). AND, you can see which dll's a program needs with dependency walker : My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matthew Leverton
Supreme Loser
January 1999
![]() |
Edgar Reynaldo said: it will take the value of %PATH% literally. If so, that's pretty pathetic. |
AMCerasoli
Member #11,955
May 2010
![]() |
You can also read a very short article talking about the differences of a dynamic or static link. Now, that you have compiled your game with the dynamic libraries your best choice is to place the same libraries you linked to your project in the folder of your executable, it's a simple copy and paste, I say it's your best choice because if you send to someone your game, without those libraries, they're going to get the same error message you're getting now ("The program can't start because allegro-5.0.5-monolith-md.dll is missing from your computer."), you can also do what Matthew has suggested, and it's good when you're working in many projects and you don't want a paste the binaries on each project folder, but remember when distributing your game to send it along with the binaries.
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
I didn't read closely enough - I didn't see you said to add a new user variable. In that case, it might work. I don't know if you can have both a system and a user variable named path though. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matthew Leverton
Supreme Loser
January 1999
![]() |
I'm speaking about doing it within Code::Blocks. They have a section (that affects all projects) for entering custom environment variables. Untested, but I think you could create a environment profile called "Allegro 5.0.5" from within Code::Blocks and adjust the PATH like I said. Whether or not it works with the %PATH% syntax, I don't know. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
That is a feature I did not know about... My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matthew Leverton
Supreme Loser
January 1999
![]() |
I don't know if this works, but you might even be able to do something like: ALLEGRO_LIB=-lallegro, -lallegro_primitives And then within your project's settings just enter this in your extra linker settings: %ALLEGRO_LIB% Then switching between different versions of Allegro (or upgrading, etc) is just a matter of selecting a new profile. |
AMCerasoli
Member #11,955
May 2010
![]() |
I change the global settings but I have to link to the libraries manually (just once of course), I can also select the compiler, but I think your way is better. I'll check it out.
|
the_get_man
Member #13,909
January 2012
|
All this uncertainty made me question what I should do next. Matthew Leverton said: Go to Settings/Environment/Environment Variables and add one that looks like:
Matthew Leverton said: I'm speaking about doing it within Code::Blocks. In c::b I go to settings>environment but there is no environment variables. Sorry for my youth in the coding world but AMCerasoli said: your best choice is to place the same libraries you linked to your project in the folder of your executable, it's a simple copy and paste, I say it's your best choice because if you send to someone your game, without those libraries, they're going to get the same error message you're getting now The executable is a.k.a the project folder? |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Settings->Compiler And Debugger->Global Compiler Settings->Custom Variables Tab Quote:
These variables can be used in compiler and/or linker options. The folder with your program in it. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AMCerasoli
Member #11,955
May 2010
![]() |
the_get_man said: The executable is a.k.a the project folder? No, the executable is a file, a file which ends with .exe (executable) on Windows, each operation system has one, it means that when you press such file it's going to execute/run something. An image (.jpg for example) is not an executable, such image is opened by a program, you don't notice the difference when opening an image or an executable because the operating system already knows with which program it is going to open the image, but the image itself, it is not an executable, you need another program (an executable) to open and watch the picture. Suppose that you create a file called "levels.dat" with your game, in other words, when you game runs and a player pass a level, your game creates such file automatically so the next time the player open the game it's able to read from that file and update the information of the player: scores, levels passed, time played, etc... That file is not an executable, it's just that... a file. But when you compile something, you're creating an executable, when the operating system open it, it's waiting for commands to execute a determined task, you can run a game or tell the computer to destroy itself. So... In your project folder, there is an executable, which should have the name of the project, the name that you gave to Code::blocks when creating the project. That executable currently is not looking for a "levels.dat" file but instead is looking for all the Allegro binaries you used to create such executable, if he can't find the binaries it won't open, because they're required, after all they're the tools you used to build your game. If you go fishing and you forgot the fishing rod... There is not much you can do, it happens the same here. Now with the static link you wouldn't need to put the binaries there, it's like when you have sex, you have everything you need to have sex, basically your mother built you with your penis statically linked to you... So you can't forget it... The same happens with the libraries.
|
the_get_man
Member #13,909
January 2012
|
I went to: Settings->Compiler And Debugger->Global Compiler Settings->Custom Variables Tab I added the variable key and value and in the Variable box I have: PATH = C:\Allegro\bin;%PATH% Now how do I use it as a compiler/linker option? Where do I put it? $(varname) means the same as $(folder_with_my_program)? If so is that the path of the folder or just the name of the folder? the program I'm guess is allegro or is it the program I'm making? The name of my project is: allegroFirstShot AMCerason: I know what an executable/.exe is but I didn't know how to find the folder within code::blocks. The way I found the .exe folder was by going to where I have my programs saved in my OS clicking on the project folder > bin > release > then the .exe is in the release folder. In this folder is where I should copy and paste the libraries I used correct? And just so I understand exactly what I've been doing these past couple days there is no .exe in Allegro so really its not installed like that right. It is just a bunch of ones and zeros that the MinGW compiler reades so that c::b can use it for GUI when its called upon? Have patients with me becuase I am more fustrated by all my questions then you are. should installing allegro really be as hard as I'm making it? |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Okay, first, I can't find any setting in CodeBlocks anywhere that actually alters your PATH at runtime, so skip that. The best option is to copy the necessary dlls to your program's folder. That way if you ever go to distribute it you won't forget to zip the dlls up with it. the_get_man said: I added the variable key and value and in the Variable box I have:PATH = C:\Allegro\bin;%PATH% Now how do I use it as a compiler/linker option? Where do I put it? $(varname) means the same as $(folder_with_my_program)? If so is that the path of the folder or just the name of the folder? It would be more useful to make a variable that contains all the linker options for using Allegro 5, such as : Key : A5LIBS Value : -Lc:\allegro\lib -lallegro -lallegro_image -lallegro_primitives -lallegro_font.....
And then you add it to your linker options like this : Quote: In this folder is where I should copy and paste the libraries I used correct? That's where you put the dlls, correct. For MinGW, the allegro libraries are *.a files. They are archives of object files. They contain function and variable definitions. A header tells you which are available, but a library is what you link to to actually use them in your program. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
the_get_man
Member #13,909
January 2012
|
What I don't understand is what is the difference between this and linking the libraries the way the Allegro install directions said. I seems that it is the exact say thing anyway Now inside my variable box I have: A5LIBS = Lc:\allegro\bin -lallegro_acodec -lallegro_audio -lallegro_color -lallegro_dialog -lallegro_font -lallegro_image -lallegro_memfile -lallegro_physfs -lallegro_primitives -lallegro_ttf -lallegro i used the file path "bin" instead of "lib" like you said because I linked dynamically. Edgar Reynaldo said: It would be more useful to make a variable that contains all the linker options for using Allegro 5, such as :
"The program can't start because allegro-5.0.5-monolith-md.dll is missing from your computer. Try reinstalling the program to fix this problem" The files in my c:\allegro\bin I am using to link include: allegro_acodec-5.0.5-md.dll
|
|
1
2
|