Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » cannot find -lalleg

This thread is locked; no one can reply to it. rss feed Print
cannot find -lalleg
machine
Member #11,569
December 2009

Hi guys,

I'm trying to install allegro 4.4.0.1 on Windows vista (I have allegro on xp working), 32-bit platform.

I downloaded and installed cmake, mingw, set environment variables, g++ complier works etc...

I extracted allegro dir into mingw dir, in allegro dir I executed:

Cmake -G "MingGW Makefiles"

No complaints for dependencies, works.

next I executed (again, in allegro dir):

mingw32-make

then:

mingw32-make install

no complaints again, compiled and installed successfully.

But when I try to test allegro using command to static link on this test file:

#include <allegro.h>
int main(){
allegro_init();
install_keyboard();
set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
readkey();

return 0;
}
END_OF_MAIN();

g++ test.cpp -o test -lalleg

it spits out:

...\mingw32\bin\ld.exe: cannot find -lalleg

Not sure if I missed anything during install. I reinstalled, same thing.

Thanks for any replies.

Robert Hightower
Member #5,830
May 2005

I am having essentially the same issue.

4.4.0.1, Windows XP, brand new install of mingw, etc. I built everything just fine (i.e. all the examples work like I remembered them), but when trying to build a trivial program I get:

c:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lalleg

I found some reference to calling fix.bat (which I vaguely remember doing previously, but that was before cmake) on the wiki, and an old (2005-ish) post mentioning `allegro-config --libs`, but I've been unable to make either work. What am I neglecting to do?

On another note, it pleases me greatly to see that Allegro is still in active development. Keep up the good work ;D

Arthur Kalliokoski
Second in Command
February 2005
avatar

Did you remember to set the MINGW environment variable?
(check allegro\docs\build\mingw32.txt)

Was the liballeg.a actually copied to the Mingw\lib directory? In other words, if you didn't do a make install in administrative mode, it might not have worked.

They all watch too much MSNBC... they get ideas.

Robert Hightower
Member #5,830
May 2005

Actually, I just found a solution!

The build process, in addition to making a dll, also made something called "liballeg44.dll.a". This seems to be misnamed. Renaming this file liballeg.a makes everything work just fine; I can now link Allegro dependent programs without issue. Of note, it is not a copy of the dynamic library, it is about half the size. Also, liballeg.a is otherwise missing. Therefore, I'd imagine this is just a naming issue somewhere in the makefile.

machine
Member #11,569
December 2009

Robert:

It links correctly when I rename the file, but fails to execute - could not find alleg44.dll

Arthur:

Re-checked, path is set correctly. Reinstalled in adminstrative mode, same thing.

Apart from trying to install allegro, Vista is annoying :)

Robert Hightower
Member #5,830
May 2005

Machine:

Ensure that there's a copy of alleg44.dll in the same directory as the program you're writing, or, better yet, on the path somewhere. My approach is to just copy it to mingw\bin, since that's already in the path anyway. Someone else may have a better solution though, so defer to them :)

machine
Member #11,569
December 2009

Weird. Copied the .dll into the bin dir, works now.

Thanks and good job Robert!

So once more to reiterate if anyone else comes across (note: for MinGW install under Vista):

1)download and install cmake (installer package available)
2)download and install mingw, select full install
2a)set environment variables for complier binaries in PATH as c:\MinGW\bin
3)download allegro, decompress and extract (does both automatically) to mingw directory (use WinRar or whatever)
4)go to allegro directory now, type in CMake -G "MinGW MakeFiles", this will create the relevant makefiles for allegro (type it in exactly all capitals else command won't work)
5)type: mingw32-make, this will create the object files
6)then type: mingw32-make install, this will install and link any object files (should be ran in adminstrator mode)
7)go to c:\MinGW\lib directory, rename filename: liballeg44.dll.a to liballeg.a
8)copy alleg44.dll from c:\MinGW\lib directory and write it to the c:\MinGW\bin directory

Hi Robert,

Are you able to compile with allegroGL?

LennyLen
Member #5,313
December 2004
avatar

The reason for the name change is probably to avoid a name conflict if you have Allegro 4.2 installed as well. You can just include liballeg44.dll.a instead of renaming it (after first copying it to the MinGW\lib directory).

Of note, it is not a copy of the dynamic library, it is about half the size. Also, liballeg.a is otherwise missing. Therefore, I'd imagine this is just a naming issue somewhere in the makefile.

In previous versions of Allegro, liballeg.a is the dynamic version, as is liballeg44.dll.a in this version.

machine
Member #11,569
December 2009

Hi Lenny,

The file was already in the \lib directory.

Do you know if version 4.4 includes allegroGL?

LennyLen
Member #5,313
December 2004
avatar

machine said:

Do you know if version 4.4 includes allegroGL?

It does.

machine
Member #11,569
December 2009

###

Robert Hightower
Member #5,830
May 2005

LennyLen:

Sorry for the ambiguity, I should have said it is not a copy of the dynamic link library, i.e. it isn't a copy of the dll. I wasn't saying it was the statically linked version :)

Also, is there anything that depends on the library being named its current name? The main reason I ask is that the renaming ensures that all my old makefiles from stuff I was working on ages continue to work.

Machine:

Yes, though the library's name was changed. The details are in your other thread.

Go to: