|
Using Allegro 5 with CodeBlocks |
LadyInRed7
Member #15,941
April 2015
|
Hey guys Im new to allegro and this forum. So here is the query,what library should I make, a shared one or a static library?? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You can compile Allegro directly with MinGW, the compiler that comes with CodeBlocks. You can create either a "MinGW Makefiles" makefile to use directly with mingw, or a "CodeBlocks - MinGW Makefiles" Code Blocks project that uses mingw indirectly. Anyway, first steps are to install MinGW and CMake properly. The MinGW distribution is usually installed in c:\mingw, or in some sub directory of code blocks, but I prefer the former as CB can easily detect it when it is in c:\mingw. Next, make sure the \mingw\bin directory is on your path, so that gcc and g++ are on your path. You can do this through environment variables in the system settings control panel or set it at runtime from a command line by typing in : set path=c:\mingw\bin;%PATH% After that install the latest CMake and make sure to check the option to add cmake to your path so you can run it from the command line as easily as mingw. Then the general steps are to : cd allegro_source_directory mkdir build cd build cmake -G "MinGW Makefiles" -DSHARED=[On | Off] -DCMAKE_BUILD_TYPE=[Release | RelWithDebInfo | Debug | Profiling] -DWANT_MONOLITH=[On | Off] .. mingw32-make mingw32-make install In the step where you run cmake, replace "MinGW Makefiles" with one of the generators mentioned when running 'cmake --help' at the cmd line if you're not using MinGW directly. The options like this : [On | Off] mean to replace that with one or the other, and similarly with the build type. want monolith determines whether you build allegro as a single library or as several. The .. at the end means to look in the parent directory for the CMakeLists.txt file. You should see what version of MinGW you're using first by running 'g++ --version' at a command line after adding \mingw\bin to the path. I can't say one way or the other to use dynamic or static versions of the library ( the SHARED cmake variable ). Dynamic versions leave you dependent on dlls, but static versions are harder to link. All depends on how you want to distribute your programs as well. 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 |
LadyInRed7
Member #15,941
April 2015
|
Hey Edgar,I downloaded a separate installation of MinGW(except the one I had with CodeBlocks).I set the enviroment path to c:\mingw,but after checking if MinGW is in my path,I seem to be lost. I am stuck in this line cmake -G "MinGW Makefiles" -DSHARED=[On | Off] -DCMAKE_BUILD_TYPE=[Release | RelWithDebInfo | Debug | Profiling] -DWANT_MONOLITH=[On | Off] .. Cmake asks the following question:- CMake Error: The source directory "C:/C++ Programs/Games/allegro4.2/include" does not appear to contain CMakeLists.txt. What do I do? Pls help guys,I would be indebted... |
Edgar Reynaldo
Major Reynaldo
May 2007
|
LadyInRed7 said: I set the enviroment path to c:\mingw Just be careful to keep the rest of the path when changing a system environment variable from the control panel, or you could screw up a bunch of things. You want to be in your build folder when running cmake and mingw32-make. cd allegro_source mkdir build cd build And the cmake command is like this : cmake -G "MinGW Makefiles" -DSHARED=On -DCMAKE_BUILD_TYPE=Release .. The .. means look in the parent folder for CMakeLists.txt 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 |
LadyInRed7
Member #15,941
April 2015
|
Hey Edgar,I was browsing the a.cc forums and I came across the unofficial distro of the Allegro 5.1 or something... |
Edgar Reynaldo
Major Reynaldo
May 2007
|
If you want to use binaries you need to have them match your compiler version. Allegro 4 and Allegro 5 are completely separate libraries. They are not compatible with each other. You can use Allegro 4.4.2 as that is the latest version of Allegro 4, and that will still be compatible with your book. Otherwise you would have to learn an entirely different api to use Allegro 5 and your book wouldn't help you anymore. I do offer binary distributions for MinGW 4.8.1 and Allegro 5.1.9 but like I said, those aren't compatible with your book. 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 |
LadyInRed7
Member #15,941
April 2015
|
Well, leaving the book aside, I can still makeup with Allegro 5.But before I do so,could you tell me how to use the dlls of the unofficial distro?? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
To use my binary distribution of MinGW use 7-zip to extract the archive. Move the compiler folder to c:\mingw and set your path variable. To use the binary distribution of Allegro 5.1.9, you extract the binary and then set the appropriate include directories, which are the compiler include path for searching for headers (.h, .hpp), and the linker search path for finding *.a archive files. The binary distro comes with /bin, /include, and /lib folders. The dlls are in the bin folder, and you put them with your program. The include folder is for the compiler to know how to compile everything. The lib folder contains the *.a archive files that you need to link with. These are all project settings in CodeBlocks. I don't have CB handy atm so I can't guide you explicitly how to use them. Edit 1) Goto Project->Build Options in the menu This is telling the linker to link to liballegro_monolith.dll.a, liballegro_monolith-debug.dll.a, liballegro_monolith-static.a, or to liballegro_monolith-debug-static.a. You can add any of these in as a link library on the left hand side of the dialog as well. {"name":"609399","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/6\/967d21488c2475ddf3c32b9719cc0c99.png","w":748,"h":536,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/6\/967d21488c2475ddf3c32b9719cc0c99"} If you choose to link statically, there is a long list of other libraries you need to link to : -ldumb -lFLAC -lvorbisfile -lvorbis -lfreetype -logg -lzlibstatic -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi -lopenal32 -lgcc_eh -static-libstdc++ -static-libgcc
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 |
Polybios
Member #12,293
October 2010
|
I just noticed that msys2's package manager comes with a pre-built package for Allegro 5.0.11. I haven't noticed before, but I haven't done much Windows stuff for a long time. |
|