Sign in to follow this  
HolyHillBilly

How do I link my DLLs to Code Blocks?

Recommended Posts

I just want to build and run some simple allegro code in code blocks, and I've been trying for the last two days to install the allegro library, build/compile it from the zip files, and link it to code blocks.

I finally got to the point where my program will build without error codes, but when I run it I get this:

 

The program can't start because allegro_primitives-5.0.10-md.dll is missing from your computer. Try reinstalling the program to fix this problem.

 

I tried copying the dll file directly into the folder my project is in, but the system just comes up with another missing dll to complain about. Is there anything I can do short of copying hundreds of dll files into my project folder?

Share this post


Link to post
Share on other sites
This doesn't have much to do with Code::Blocks, but with properly installing the Allegro libraries, which unluckily is, indeed a process of "copying around DLLs". Note that copying headers and import libraries to places where Code::Blocks will find them isn't enough (you probably thought that this is it for "installing" the library, but it is only half the story).

There are mainly two places where the DLLs can be copied, the system32 directory, or the directory the program is in. Actually, putting the DLLs into the system directory is the "correct thing" seeing how they are shared libraries, and there is not much sharing if every program has its own libs in its own directory. However, in practice, one usually does exactly the opposite.

Normally, when you build a library and run something like "make install", this should already place the DLLS in the system directory. Which is both good and bad. Good because you can immediately run any program that uses them (so, not much stalling development), but bad because when you deploy your software, you must remember that this has to be done on the end user's computer, too (having libs in the program's dir, you can just zip everything up and be good).

I'm not very familiar with Allegro, only having used it once ages ago... is there not an option to make a monolithic build? That would mean only one DLL needing to be copied around, less trouble.

Share this post


Link to post
Share on other sites

I tried copying the dll file directly into the folder my project is in, but the system just comes up with another missing dll to complain about...


You can use Dependency Walker to find all the DLLs you need, though I suspect you would only need to copy all the allegro DLLs.
 

There are mainly two places where the DLLs can be copied, the system32 directory, or the directory the program is in...

Actually, putting the DLLs into the system directory is the "correct thing"...


I disagree. According to Dynamic-Link Library Search Order for Desktop Applications, it also searches %PATH%, which I argue would be much cleaner than whoring out the system directory to third party libraries. Just add the allegro binary directory to %PATH% and you should be good to go.

I prefer copying (or hard-linking) the DLLs directly into the project directory, that way I can zip-and-deploy at any time. And also avoids the problem (for some libraries):
libwowamazing.dll: x86 or x64? debug or release? Linked against the mutli-threaded runtime or the static runtime? Edited by fastcall22

Share this post


Link to post
Share on other sites

This tutorial shows you how to add libraries to be linked with the compiler. 

 

https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5

 

Usually you want to put all your dlls of allegro in one place, and refernce the whole folder. (to be linked against, so it may find dlls there)

Share this post


Link to post
Share on other sites

Ok, I get the Dlls figured out (I think). But now I'm getting this error:

 

The procedure entry point_gxx_personality_v0 could not be located in the dynamic link library

C:\GameDev\Projects\Game1\test\bin\Debug\allegrp-5.0.10-md.dll

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this