Help getting Allegro 5 and Dev-C++ to work together on 64 bit Windows 7 machine
BletchleyPark

Is there a complete, coherent guide anywhere that explains how to add Allegro 5 libraries to Dev-C++ (version 5.11) and get those libraries to work on a 64 bit Windows 7 machine? I am at my wit's end trying to stitch together information that is outdated and incomplete. Thanks.

Bob Keane

Do you have to use Dev-C++? Allegro is fairly simple to install with Code::Blocks. You just need to make sure the binaries match your compiler.

BletchleyPark

I don't have to use Dev-C++, but would prefer to avoid learning a new IDE if it isn't necessary. Having said that, I installed Code Blocks on my machine and successfully compiled non-Allegro code with it. However, I am now having the same problem with Code Blocks I was having with Dev-C++. The specific details of telling Code Blocks that the Allegro libraries exist and how to find them are described too vaguely to be of any use to someone who has no prior knowledge of the IDE. For example, one instruction says, "Put such and such path in the compiler search options." Since the location of the compiler search options isn't given, I have to guess where it is and what needs to go there. Am I having problems because I guessed wrong, or did I get it right and the problem lies elsewhere? I don't know, and I will be dead of an aggravation provoked stroke before I can run down the hundreds of things it could possibly be through trial and error.

So if you would be kind enough to walk me through the process, or point me to the guide that makes the process as simple as you say, I would appreciate it. Otherwise, I will abandon coding and take up something less aggravating, like organic chemistry. ;D

Edgar Reynaldo

Well, there used to be a really nice wiki page for CB and Allegro 5. But the wiki died and it hasn't been replaced yet. :(((( :-/

Seriously, use CB, it's much better than Dev-C++.

I can tell you how to do it all.

First leave your global compiler options alone. You said you have a working non allegro program. That's good. That means your compiler works.

Next, to use Allegro 5, you have to have binaries that match the compiler you're using. You can use the official binaries, or I have some for Allegro 5.2.5 if that's recent enough for you.

Next step, for any application, make a new project. Menu->File->New->Project.

Then at any time the project is active, you can go to Menu->Project->Properties or Build Options. This is where you set everything up. In Build Options, select the global project on the left and go to search directories on the right. Add in the compiler search directory for the allegro includes here. Add in the linker search directory for the allegro libs under the linker tab.

Then under each project type, select the linker options on the right, and add the allegro libraries here.

Project properties let you set things like gui/console, output executable, runtime working directory, and more.

dthompson

Did anybody take a dump of the old wiki? I just checked and it redirects straight to the new one - not sure when that started happening.

When I was on my 'sabbatical' I had a stab at porting as many of the articles as possible, but I didn't (and still don't) have time to do it all, so I'm afraid I had to prioritise newer, more relevant info :(

Edgar Reynaldo

I'm sure tomasu would keep one. You'd have to ask him on IRC on #allegro, but he's not around often.

Rodolfo Lam

They are still available on the Wayback Machine. That’s the only copy I’ve found of the old MediaWiki site.

BletchleyPark

To the best that I have been able to determine, I am using a binary compatible with my system/compiler. I followed your instructions to the letter, and the compilation failed with 25 error messages, each an "undefined reference" to an allegro specific function. This is the same result I have been getting for as long as I have tried to get Allegro to work.

Over the course of failing to solve this problem with Code Blocks, a curious issue came up. Dev-C++ requires that the user inform the compiler about include files, and the linker about lib files, in a manner similar to CB. However, Dev also has a tab that is used to provide a search path to the bin files, while CB does not, or at least not that I could find. What are the bin files used for?

Edgar Reynaldo

Then under each project type, select the linker options on the right, and add the allegro libraries here.

{"name":"612601","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8ea6a92ff4740a135a5b52086956861c.png","w":920,"h":750,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8ea6a92ff4740a135a5b52086956861c"}612601

BletchleyPark

The error message now is "No such file or directory."

I might simply be too stupid to make this work.

Edgar Reynaldo

Did you add the lib directory to the search options in the linker tab?

Did you add the include directory to the search options under the compiler tab?

Where are your library files?

Bob Keane

My Allegro files are in my Documents folder. Here are a few screenshots:

Under the search directories:

Compiler include directories:

{"name":"612608","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/6\/06f17926724156a6c9a198df57657656.png","w":752,"h":739,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/6\/06f17926724156a6c9a198df57657656"}612608

If you press the add key at the bottom, you should get a dialogue box to navigate to the folder.

Then hit the linker tab to bring up the linker search directories:

{"name":"612609","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/1\/f1a3e27aab89f60d698dd2681c26f7a3.png","w":752,"h":739,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/1\/f1a3e27aab89f60d698dd2681c26f7a3"}612609

Same thing with the add button for the dialogue box. Friendly tip: If you want to link statically, copy and paste this list to the "other linker options" box under the linker settings tab:

-lallegro_monolith-debug-static
-ljpeg
-ldumb
-lwebp
-lFLAC
-ltheora
-lvorbisfile
-lvorbis
-logg
-lphysfs
-lfreetype
-lpng16
-lzlibstatic
-ldsound
-lgdiplus
-luuid
-lkernel32
-lwinmm
-lpsapi
-lopengl32
-lglu32
-luser32
-lcomdlg32
-lgdi32
-lshell32
-lole32
-ladvapi32
-lws2_32
-lshlwapi
-lpthread

Probably should ask, when you downloaded Code::Blocks, you got the version without the compiler, correct?

BletchleyPark

The enclosed screenshots reflect the state of Code Blocks on my machine after following Mr. Reynaldo's advice. In the linker settings, I did not include the Eagle debugging flags because I don't have anything like that on my machine that I know of. The specific library name used in that box reflects the closest equivalent in the bin folder. While Mr. Reynaldo's advice said that I could ignore the global settings and use the project settings instead, the screenshots here show global settings. I tried it both ways; neither way worked.

I haven't followed Mr. Keane's advice yet, but to answer his question, the version of Code Blocks I downloaded did include (I assume) the GNU GCC compiler seen in Compiler Settings.

Perhaps after you've reviewed the screenshots, we will have a better idea of where we are.

Edgar Reynaldo

Here's an example project. You'll have to change the search directories.

Example.cbp.

And none of this matters if the compiler you're using doesn't match the binary version of allegro.

Bob Keane

I think I see the problem. CodeBlocks is using the prepackaged compiler.

Try pointing to the Allegro compatible compiler in the compiler installation directory:

{"name":"612618","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/f\/bff3159b11ea453b30c52a97a02f96e3.png","w":754,"h":739,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/f\/bff3159b11ea453b30c52a97a02f96e3"}612618

Also, use the "..." buttons on the C and C++ compiler lines to find the gcc.exe and g++.exe files in the same directory. And compare the other settings in my list to yours.

I am assuming you installed the Allegro mingw compatible compiler in a separate folder from CodeBlocks\MINGW.

BletchleyPark

I haven't done anything with Mr. Reynaldo's example file yet. I thought I would try Mr. Keane's advice regarding the compiler first. Still not working. The enclosed screenshots show the compiler path and settings, and the version of Allegro I am using.

Bob Keane

Can you take a screen shot of your C:\MINGW folder please? There is something I'm not seeing. Also, use the formatting help button to show your images in your posts. First, click on the drop attachments button, then upload the file, copy the link location by right clicking the file and selecting copy link location, then type the quote marks are necessary. Allegro is having problems.

BletchleyPark

{"name":"612623","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/2\/42a691072d67c251b299bb2de590424f.png","w":626,"h":306,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/2\/42a691072d67c251b299bb2de590424f"}612623

It took seven screenshots to capture the entire bin folder. In the interest of saving bandwidth, I will upload something more specific when you have determined what you need and let me know.

Thank you, and Mr. Reynaldo, for your help.

Bob Keane

Okay, thanks. Can you upload the contents of the bin folder please? I'm still not seeing what I am looking for.

BletchleyPark

{"name":"612624","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/0\/00a58ae6cbbef9da17af2a81f40b0a76.png","w":1204,"h":856,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/0\/00a58ae6cbbef9da17af2a81f40b0a76"}612624

{"name":"612625","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/24b3983cd7d2950af1c020ffc5edf34b.png","w":1204,"h":856,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/24b3983cd7d2950af1c020ffc5edf34b"}612625

Bob Keane

I compared your bin folder to mine and I did not see some files which I have. This leads me to believe code::blocks is using the wrong compiler. Try deleting your C:\MINGW folder, and delete any downloaded compilers to avoid confusion. Then download this compiler, unzip it to C:\MINGW (you probably will need to recreate the folder). Don't use the autodetect feature in code::blocks to find the compiler. Use the "..." button to drill down to the folder containing the gcc.exe and g++.exe files. If that does not work, you may need to remove code::blocks, download the version without the compiler and reinstall. Here is a link to the Allegro files I use. They are compatible with the compiler. Just in case you need them. Uploads are failing, or the files I'm uploading are too big. I believe the code::blocks version you need is this one.

BletchleyPark

{"name":"612626","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/a\/bac0a82a2d30d5e2567893910fef5cf3.png","w":500,"h":500,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/a\/bac0a82a2d30d5e2567893910fef5cf3"}612626
{"name":"612627","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6ab400f1626161e37d0eb81083148ee6.png","w":500,"h":500,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6ab400f1626161e37d0eb81083148ee6"}612627

This is the state of things now.

Bob Keane

I noticed you have "allegro-i686-w64-min32gw-gcc-9.2.0-po..." in your downloads, is that the version you are using? They may not be compatible with your compiler. Try deleting the Allegro files you are using and download the ones I linked. I've never done dynamic linking, so I am not sure what the linker options should be.

BletchleyPark

The link you supplied for the Allegro files downloaded the files for the compiler instead.

Bob Keane
Edgar Reynaldo

I will show you how to do it from scratch.

Uninstall CodeBlocks 20.03 and reinstall it. This time don't install the MinGW compiler. You will be using your own installation of MinGW.

Second, your allegro binaries need to match the compiler they were created with in order to work. You're using SiegeLord's GCC 9.2 binaries with a different compiler. That won't work.

This time, make sure they match. For instance, these are my builds, which already match :

The compiler I'm using is MinGW-W64 i686 (32 bit) GCC 8.1, which you can get here :

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z

The allegro binaries I built you can find here :

https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/

Specifically, these :

https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/Allegro525_GCC81_MinGW_W64_i686_posix_dwarf.7z

Extract the compiler and move it to c:\mingw . Now ONCE go into your global compiler settings then make sure they look like this :
{"name":"612629","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/a\/1a8d089f602f652deab726a95abede71.png","w":923,"h":821,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/a\/1a8d089f602f652deab726a95abede71"}612629

Extract the binaries and move it to c:\libs . You should now have c:\libs\include and c:\libs\lib and c:\libs\bin .

Now, don't touch your global compiler settings again.

Next, load the project I gave you earlier and change the project search directories to match your c:\libs\ include and lib folders.

Then double check your linker settings for each project. They should be preset to the necessary libraries.

Add a source file to your project. Go to File->New->File and add it under the current project. Add it to all configs. Put in a basic main and build the project. All should go smoothly. If it does NOT, post screenshots and logs of your errors.

;)

BletchleyPark

{"name":"612634","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/6\/8661ad6181cae85644d44028915d11f0.png","w":600,"h":586,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/6\/8661ad6181cae85644d44028915d11f0"}612634
{"name":"612635","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/6\/46beb9693f6a036f23941dcbfce6a81c.png","w":611,"h":221,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/6\/46beb9693f6a036f23941dcbfce6a81c"}612635
{"name":"612636","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/b\/9b4a906edfb23822442a1131dd7bfca7.png","w":608,"h":211,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/b\/9b4a906edfb23822442a1131dd7bfca7"}612636
{"name":"612637","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/0\/003480a0ef6f9bc988e6d21e161081d3.png","w":592,"h":598,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/0\/003480a0ef6f9bc988e6d21e161081d3"}612637

Edgar Reynaldo

Go to Settings->Compiler pick Toolchain Executables, and fix your compiler.

Bob Keane

...My bad. I should have been more specific in my earlier post. Do not use the auto-detect button in the toolchains executables tab, this could be causing confusion. In your C:\MINGW folder, you should have a folder labelled "i686-8.1.0-release-posix-dwarf-rt_v6-rev0". If you have it, there will be a "mingw32" folder under the i686-8.1.0-release-posix-dwarf-rt_v6-rev0 folder. Under the "mingw32" there should be a "bin" folder. Start Code::Blocks, go into settings, bring up the toolchains executable tab, use the "..." button to navigate to the "C:\i686-8.1.0-release-posix-dwarf-rt_v6-rev0\mingw32" folder, opening each folder as you find them until you see the "bin" folder. Highlight the bin folder, and click the select folder button at the bottom. That should select the correct folder for the compiler. Now, the c compiler and c++ compiler lines should default to the proper bin folder. Click the "..." button next to the c compiler line and find the gcc.exe file, click on it once and press the open file button at the bottom. Do the exact same for the c++ compiler line, selecting the g++.exe file. Then press okay and you should be okay.

If you do not have the i686-8.1.0-release-posix-dwarf-rt_v6-rev0 you have the wrong compiler for the Allegro binaries Edgar provided and I linked to earlier. In that case, delete the C:\MINGW folder, delete any and all downloaded compilers from your download folder and download the compiler I linked earlier. Create a new C:\MINGW folder and unzip the downloaded compiler to that folder and look for the i686-8.1.0-release-posix-dwarf-rt_v6-rev0. Then go into the toolchains executables tab in Code::Blocks and navigate to the C:\i686-8.1.0-release-posix-dwarf-rt_v6-rev0\mingw32 folder, highlight the "bin" folder and press the select folder button. Then select the c and c++ compilers as previously instructed and you should be good.Do not use the Auto-detect button in the toolchains executable tab, that ma be causing some confusion.

Did I miss anything Edgar?

Edgar Reynaldo

All you need to do is extract the 7z file and rename the folder to mingw and move it to c:.

Then follow the picture from above :

{"name":"1a8d089f602f652deab726a95abede71.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/a\/1a8d089f602f652deab726a95abede71.png","w":923,"h":821,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/a\/1a8d089f602f652deab726a95abede71"}1a8d089f602f652deab726a95abede71.png

BletchleyPark

{"name":"612643","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/5\/b55e45cec5a7cdc1b17954d87ef32af0.png","w":1153,"h":179,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/5\/b55e45cec5a7cdc1b17954d87ef32af0"}612643
{"name":"612641","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/f\/3f675d3f21df955931b3dbe067587488.png","w":552,"h":207,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/f\/3f675d3f21df955931b3dbe067587488"}612641
{"name":"612642","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/e\/feef39e414256bf55c4a959cc5518256.png","w":641,"h":533,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/e\/feef39e414256bf55c4a959cc5518256"}612642
{"name":"612644","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/3\/83019db37223e2f87fbd55a71f285662.png","w":743,"h":1016,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/3\/83019db37223e2f87fbd55a71f285662"}612644
{"name":"612645","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/5\/b55e45cec5a7cdc1b17954d87ef32af0.png","w":1153,"h":179,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/5\/b55e45cec5a7cdc1b17954d87ef32af0"}612645

I hadn't seen Mr. Reynaldo's post before I posted my last reply, so my last reply did not encompass the assistance he provided. My apologies for the confusion.

I had looked through a guide on this site regarding compiler compatibility and assumed, foolishly, that because the MINGW version numbers on my Allegro download matched the MINGW numbers in my Dev and CB versions, that they would work together. I was mistaken.

I used the project Mr. Reynaldo provided, made the changes indicated as best as I understood them, noted the linker settings for the various debug release settings, but left those settings alone. The code I added was a an Allegro version of Hello World that I found online.

I have gathered that the Allegro files can reside anywhere on the machine, and the Search Directory tabs allow you to tell CB where those folders are so the compiler and linker can find the appropriate files. Assuming that this is true, and CB doesn't have a problem following the path, its inability to locate the file it claims is missing is perplexing. The screenshot shows it clearly in the folder on the path I gave it.

I appreciate the patience you have both shown in assisting me.

Bob Keane

Try copying the allegro_monolith-5.3.dll from your Documents folder to the folder with the executable in it. If that works, try copying the list I provided earlier for static linking.

DanielH

You got it. It's compiling and linking properly.

The problem when you run it is that you need to tell Windows where the DLL is. Either copy the DLL to your working folder or set the environment to include the folder where the DLL is located.

Not sure id Dev C++ has that option.

For newbies, the hardest part is getting the environment set up properly.

Bob Keane

I typically go with static linking (my list) because the users may not have the Allegro library on their computers.

Edgar Reynaldo

No, that's still not quite right.

Everything is correct except the link library. Link to the .a file, not the .dll .

The syntax is '-lNAME' where the link library is libNAME.a .

So you're linking to the 5.2 dll, that's not it. You want to link to liballegro_monolith-debug.a by using -lallegro_monolith-debug

Technically you can link to a .dll, but the dll is not in the lib folder so that wouldn't work anyway.

BletchleyPark

I'm not clear on what is meant by the folder with the executable in it. I tried pasting the dll into the folder with the source code, pasting into the folder where the executable will end up, and using the -L flag under Linker Settings --> Other Linker Options to point the way to the directory. The dll couldn't be found.

EDIT: I have now seen Mr. Reynaldo's reply. It seems I changed one of his settings after all. Though the smugness on the cat's face for the past 12 hours suggests who is actually guilty. ;D

The screenshot shows the state of things now.

{"name":"612646","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/4\/046d87d46019f88b2618b29b4cb10bdf.png","w":623,"h":292,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/4\/046d87d46019f88b2618b29b4cb10bdf"}612646

Bob Keane

In your project folder, there should be a bin subfolder. Under the bin sub folder you will see a release and debug folder. The executable will be in one of those folders, most likely the debug folder. Try copying the list I provided for static linking to your other linker options page under linker settings for now. That should tell us if the compiler is set properly.

BletchleyPark

{"name":"612647","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/f\/ef06e7e103437ec0c92cbbbed6e48e73.png","w":484,"h":294,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/f\/ef06e7e103437ec0c92cbbbed6e48e73"}612647

I tried pasting a copy of the dll into the bin folder you describe. The same inability to find the dll occurred. The result of linking the corresponding .a file as Mr. Reynaldo said is shown in the screenshot.

Bob Keane

I'm at work now, but could you post a screen shot of your linker settings please? I'll take another look later. Also, take screen shots of your Allegro\Allegro5 lib directories. And a screenshot of the error.

DanielH

find out where the exe file was made. Put the DLL file in that same folder. When the program is executed, that is the first place Windows looks for the DLL.

Also, if you distribute this program just include the dll.

Option 2 is less favorable. Add the Allegro path to the global path that windows uses to look for dlls.

Path = (..Do not change what was there but add to it..);MyAllegroDirectoryThatHasTheDLL

I googled this, don't know what version Windows you are using.

How to change environment variables on Windows 10

Open the Start Search, type in “env”, and choose “Edit the system environment variables”:
Click the “Environment Variables…” button.
Set the environment variables as needed. The New button adds an additional variable. ...
Dismiss all of the dialogs by choosing “OK”. Your changes are saved!

Bob Keane

He is on Windows 7 per the title.

http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx

One thing I am worried about is Edgar's toolchain executables looks a little different than mine. Bletchley may be using a set up that is part mine and part Edgar's.

Edgar Reynaldo

I'm guessing it won't run because of the runtime working directory. You need to change that so it is in the same folder as your program and the dlls.

Go to Menu->Project->Properties, go to the Build Targets tab, and change the runtime working directory to the same one where the program is built.

Don't change your system $PATH through the environment variables.

Bob Keane

Follow Edgar's advice first. IF that does not work, first delete my linker settings and enter the allegro-monolith library to compile with dynamic linking. Then recompile. It will crash when you select build and run under Code::Blocks, don't worry. Then add the folder with the executable and dll to the system $PATH variable. The folder has the executable and dll in it so it should run in DOS outside Code::Blocks. Then go to the command line, console screen or what we true geeks know is the dos prompt and type in the name of the executable. That should give us more information. I think I remember a thread from long ago in which an executable would run in dos but not Code::Blocks with a simple answer. Or you can double click the executable without changing the path from within the folder to see if it works.

BletchleyPark

{"name":"612648","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/1\/5138e85838ffab162391e4f464154f13.png","w":680,"h":171,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/1\/5138e85838ffab162391e4f464154f13"}612648
{"name":"612649","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/9\/b987390392f2a6df1c25307a357b81e9.png","w":685,"h":584,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/9\/b987390392f2a6df1c25307a357b81e9"}612649
{"name":"612650","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/a\/ea1f2a13e052170d51c87aa28bd412b7.png","w":390,"h":718,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/a\/ea1f2a13e052170d51c87aa28bd412b7"}612650
{"name":"612651","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/f\/8fc87be6c343752c4f5356d827d52904.png","w":600,"h":900,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/f\/8fc87be6c343752c4f5356d827d52904"}612651
{"name":"612652","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6ab37a5a5ef0efd94d3f3ea608525dc7.png","w":600,"h":800,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6ab37a5a5ef0efd94d3f3ea608525dc7"}612652
{"name":"612653","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e913aa6fcbfc40ad2a27b0f63dfbd49c.png","w":1155,"h":339,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e913aa6fcbfc40ad2a27b0f63dfbd49c"}612653

Wanting to preserve the settings in Mr. Reynaldo's sample project, I created a separate project to test static linking only using Mr. Keane's list. I was able to get it to the same state of failure as Mr. Reynaldo's, the only difference being that it was unable to find a different library. (libdumb, I believe.) Then I attempted to alter the window size in the code that I supplied to it, and the result is documented in the corresponding screenshot. I changed the setting that Mr. Reynaldo suggested. The error persists.

EDIT: I posted this before seeing Mr. Keane's advice, so haven't implemented it yet.

Edgar Reynaldo

You need to copy the dlls in the bin folder to the directory where your program is. Then you can run it properly.

The reason static linking isn't working is because you're compiling as a C program. On Windows, Allegro is C++. You need to use C++ on Windows because of Allegro's dependency on Direct3D, which was implemented in C++.

DanielH

The longer this takes, the more I shake my head. No wonder few people use Allegro. ;D;D

I've never use Dev C++ so can't be help much.

On the execution part:

Personally, I would set the path. Especially if you have multiple projects. Otherwise you need to copy the DLL to each project folder.

If you update Allegro, you need to update the DLL for each folder.

1. For Debugging, set the path
2. For Release, copy DLL to folder before packaging.

Edgar Reynaldo

You should never change your system path to find allegro dlls. Do it from a command line using set if you have to, or just copy the dlls.

Have you seen all the garbage that ends up on your $PATH due to installing programs? It's trash. Use 'set' to set the %PATH%.

Command line :

set path=path\to\dlls;%PATH%
cd path\to\game
game.exe

BletchleyPark

{"name":"612654","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/8\/f8fa51bfc62d5dfaba00d397bfb7de34.png","w":326,"h":210,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/8\/f8fa51bfc62d5dfaba00d397bfb7de34"}612654

This is the result with dynamic linking per Mr. Reynaldo's instructions when they were finally properly followed. I was only putting the monolith dll in the folder instead of all of them, because I misunderstood what "monolith" dlls do.

The project I intend for Allegro will be small enough that dynamic linking will offer no advantage over static. So I will get this Hello World program working with static linking next.

As far as Dev goes, the compiler that comes with it doesn't work with Allegro and is a bazillion years old to boot. I will jump on the CB bandwagon, which, given how slowly I learn, is sure to annoy many of you. ;D

Thank you all for your help and your patience.

EDIT: It is now working with static linking using Mr. Keane's static linking list and Mr. Reynaldo's insight about Allegro's reliance on C++ dependent libraries. I saved the source file in .cpp format before inserting it into the project and it worked right off the bat.

Peter Hull

Well Done B.P.!

DanielH said:

The longer this takes, the more I shake my head. No wonder few people use Allegro.

It would be good if someone could summarise the instructions for this somewhere on the website.

Bob Keane

{"name":"5138e85838ffab162391e4f464154f13.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/1\/5138e85838ffab162391e4f464154f13.png","w":680,"h":171,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/1\/5138e85838ffab162391e4f464154f13"}5138e85838ffab162391e4f464154f13.png

I remember banging my head against that for quite a while. Edgar is right about compiling as a C++ program as opposed to a C program. Of course if dynamic linking is better suited to your needs, don't worry about static linking. Just remember to include the dlls when you distribute your programs.

Edgar Reynaldo

DanielH said:

The longer this takes, the more I shake my head. No wonder few people use Allegro.

It would be good if someone could summarise the instructions for this somewhere on the website.

I already did. :( I did it on the old wiki though, but it is gone, and I couldn't get in touch with Tomasu

This is the result with dynamic linking per Mr. Reynaldo's instructions when they were finally properly followed. I was only putting the monolith dll in the folder instead of all of them, because I misunderstood what "monolith" dlls do.

No, you understand correctly. It is a monolith because it includes all the addon libraries, but it does not include the dependencies, correct.

EDIT
I rewrote the guide from the old wiki for the new wiki.

Read here (comments welcome) :

https://github.com/liballeg/allegro_wiki/wiki/Install-Allegro-from-binaries-for-MinGW-and-CodeBlocks

Thread #618247. Printed from Allegro.cc