Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » dev c++ makefile build error

This thread is locked; no one can reply to it. rss feed Print
dev c++ makefile build error
thomp33
Member #10,721
February 2009

Earlier i had allegro installed and working. It was installed trough devpaks. Today i tried to install allegrogl manually because devpak wasn't up to date so i had to fix those enviroment values 'MINGDIR = c:/devcpp' & 'PATH = c:/devcpp/bin' (i suppose those are right?) I got everything installed manually no errors etc.

But now i'm getting this error when trying to compile anything (no matter what code):
[Linker error] undefined reference to `__cpu_features_init'
ld returned 1 exit status
C:\devcpp\Makefile.win [Build Error] [Project1.exe] Error 1

I uninstalled dev c++, allegro, mingw32 everything and then installed all back and downloaded allegro devpak. And now it is still giving me the same error when trying to compile. I have no idea what is this. I have libraries linked '-lalleg' and i removed those enviroment values also, restarted but still the same. Does someone know how to fix this?

LennyLen
Member #5,313
December 2004
avatar

Can you provide a full build log, so we can see how Dev-C++ is invoking GCC? Alternatively, try comiling and linking from the command line to see if you get the same error.

thomp33
Member #10,721
February 2009

I guess this is all it gives:

Compiler: Default compiler
Building Makefile: "C:\devcpp\setti\test\Makefile.win"
Executing make...
make.exe -f "C:\devcpp\setti\test\Makefile.win" all
g++.exe Untitled1.o -o "Project1.exe" -L"C:/devcpp/lib" -lldpng -lpng -lz -lagl -lalleg -luser32 -lgdi32 -lopengl32 -lglu32

/mingw/lib/crt2.o(.text+0x37):crt1.c: undefined reference to `__cpu_features_init'
collect2: ld returned 1 exit status

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

Execution terminated

Sorry don't know how to compile from command line.

LennyLen
Member #5,313
December 2004
avatar

The problem is probably that the libraries are being linked in the wrong order. I have absolutely no idea how Dev-C++ deteremines what order to link them in however, as I gave up on it as an IDE years ago.

You can try to adjust it manually however by bringing up a command prompt, navigating to your project's directory and entering the following line:

g++.exe Untitled1.o -o "Project1.exe" -L"C:/devcpp/lib" -lldpng -lpng -lz -lagl -lalleg -luser32 -lgdi32 -lopengl32 -lglu32

You'll need to play around with the order of the libs (the parameters starting with -l) until you find the order that works.

thomp33
Member #10,721
February 2009

The order is right but it is not about it, i tried it only with the neccessary -lalleg and simple code but still it gives the same error. This is very weird because i removed and reinstalled everything.. I downloaded dev c++ with mingw and gcc then allegro devpak. I removed all earlier configuration files so there should be nothing to mess this up. I also tried installing mingw manually but also reinstalled it, don't know if it did something.

LennyLen
Member #5,313
December 2004
avatar

Uninstall the devpak and try the prebuilt binaries from here.

thomp33
Member #10,721
February 2009

Okay it seems allegro is not the problem. I cannot compile anything. Something to do with makefile & mingw.

LennyLen
Member #5,313
December 2004
avatar

The best way to proceed would be to first uninstall and remove everything. Then get the MinGW installer from here and use it to download and install MinGW for you. Choose the Current build, and make sure you have the following components selected: base tools, g++ compiler, MinGW make.

Then download the IDE (Dev-C++ if it's what you really want, but I'd recommend you try Code::Blocks instead as it's a million times better) and install it without MinGW.

Then you can download and install your libraries (just so you know, C::B can also use Devpaks).

thomp33
Member #10,721
February 2009

Okay thanks i gotta try that.

Go to: