Trying to use allegro with devC++ via devpak
mabufo

I've been very confused with trying to 'install' allegro. I found out that devc++ has a package manager tool that would do it for me. I'm not very good at all this sort of installation stuff so I thought that would be helpful. So i found a 'devpak' online here: http://devpaks.org/details.php?devpak=1 . I installed the pak, and I started a new, empty, project and tried to run this code:

#include <allegro.h>

int main(void)
{
        allegro_init();
        allegro_message("Hello World!");

        return 0;
}
END_OF_MAIN()

I get these errors in my compile log:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make clean
rm -f Untitled1.o Project1.exe

g++.exe -c Untitled1.cpp -o Untitled1.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

g++.exe Untitled1.o -o "Project1.exe" -L"C:/Dev-Cpp/lib"

/mingw/lib/crt2.o(.text+0x167):crt1.c: undefined reference to `__cpu_features_init'
Untitled1.o(.text+0x27):Untitled1.cpp: undefined reference to `_install_allegro_version_check'
Untitled1.o(.text+0x33):Untitled1.cpp: undefined reference to `allegro_message'

Untitled1.o(.text+0x68):Untitled1.cpp: undefined reference to `_WinMain'
collect2: ld returned 1 exit status

make.exe: *** [Project1.exe] Error 1

Execution terminated

Was there something else I was supposed to do after the devpak was installed?

LennyLen

You need to add liballeg.a as a linker option.

mabufo

How do I add that if I am using a devpak via the package manager?

LennyLen

It has nothing to do with the package manager. From memory (I no longer have Dev-C++ installed), one of the menu option is 'project options.' Try there.

hellochar

I had this exact same problem. The way I fixed it is by copying alleg42.dll from the bin folder into the C:\WINDOWS\system32 folder.

LennyLen
Quote:

I had this exact same problem. The way I fixed it is by copying alleg42.dll from the bin folder into the C:\WINDOWS\system32 folder.

That won't do anything to fix his problem.

mabufo

I don't see the liballeg.a file anywhere in my file tree. I know that it exists within the devpak though\, I just can't seem to get to it.

LennyLen
Quote:

I don't see the liballeg.a file anywhere in my file tree. I know that it exists within the devpak though\, I just can't seem to get to it.

Windows does come with a file search.

mabufo

I was under the impression that it would work properly after installing the devpak.

what additional steps are needed?

Thomas Fjellstrom
Quote:

what additional steps are needed?

It was already mentioned. You need to tell your project to link to allegro.

mabufo

My question is, how do I do that with a DEVPAK installation of allegro?

EDIT: Problem solved, the trouble was that I had more than one installation of Mingw... I didn't realize devc++ installed it as well.

Thread #597023. Printed from Allegro.cc