Hi all!
I'm at work - newly hired:) - and I'm given this mpeg2 video codec

http://www.mpeg.org/MPEG/video/mssg-free-mpeg-software.html

and in particular the decoder that exists in the folder mpeg2v12.zip.
It is code c written for gcc, so I decided to download MinGW and DevC/C++. I add all the files to the project and then clicked compile.Compilation always stops though because of errors with the linker:

[Linker error] undefined reference to `__cpu_features_init'
140:8 C:\MPEGORG_CODEC\src\mpeg2dec\spatscal.c ld returned 1 exit status

:'( I am trying to solve this problem the whole day.I tried rebuild all, clean, compile, with all possible combinations but nothing worked.
I noticed though while googling a lot of links reporting linker errors with dev-c++.

I am just started learning C and C++ and I feel very discouraged...:(
Anybody any idea?


compilation log is attached.

Attachments
Compiler: Default compiler
Building Makefile: "C:\Dev_Cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Dev_Cpp\Makefile.win" all
gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/display.c -o ../MPEGORG_CODEC/src/mpeg2dec/display.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/getbits.c -o ../MPEGORG_CODEC/src/mpeg2dec/getbits.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/getblk.c -o ../MPEGORG_CODEC/src/mpeg2dec/getblk.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/gethdr.c -o ../MPEGORG_CODEC/src/mpeg2dec/gethdr.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/getpic.c -o ../MPEGORG_CODEC/src/mpeg2dec/getpic.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/getvlc.c -o ../MPEGORG_CODEC/src/mpeg2dec/getvlc.o -I"include"   

../MPEGORG_CODEC/src/mpeg2dec/getvlc.c:350:8: warning: extra tokens at end of #endif directive

../MPEGORG_CODEC/src/mpeg2dec/getvlc.c:370:8: warning: extra tokens at end of #endif directive

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/idct.c -o ../MPEGORG_CODEC/src/mpeg2dec/idct.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/idctref.c -o ../MPEGORG_CODEC/src/mpeg2dec/idctref.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/motion.c -o ../MPEGORG_CODEC/src/mpeg2dec/motion.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/mpeg2dec.c -o ../MPEGORG_CODEC/src/mpeg2dec/mpeg2dec.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/recon.c -o ../MPEGORG_CODEC/src/mpeg2dec/recon.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/spatscal.c -o ../MPEGORG_CODEC/src/mpeg2dec/spatscal.o -I"include"   

../MPEGORG_CODEC/src/mpeg2dec/spatscal.c:95:8: warning: extra tokens at end of #endif directive
../MPEGORG_CODEC/src/mpeg2dec/spatscal.c:126:8: warning: extra tokens at end of #endif directive
../MPEGORG_CODEC/src/mpeg2dec/spatscal.c:140:8: warning: extra tokens at end of #endif directive

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/store.c -o ../MPEGORG_CODEC/src/mpeg2dec/store.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/subspic.c -o ../MPEGORG_CODEC/src/mpeg2dec/subspic.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/systems.c -o ../MPEGORG_CODEC/src/mpeg2dec/systems.o -I"include"   

gcc.exe -c ../MPEGORG_CODEC/src/mpeg2dec/verify.c -o ../MPEGORG_CODEC/src/mpeg2dec/verify.o -I"include"   

gcc.exe ../MPEGORG_CODEC/src/mpeg2dec/display.o ../MPEGORG_CODEC/src/mpeg2dec/getbits.o ../MPEGORG_CODEC/src/mpeg2dec/getblk.o ../MPEGORG_CODEC/src/mpeg2dec/gethdr.o ../MPEGORG_CODEC/src/mpeg2dec/getpic.o ../MPEGORG_CODEC/src/mpeg2dec/getvlc.o ../MPEGORG_CODEC/src/mpeg2dec/idct.o ../MPEGORG_CODEC/src/mpeg2dec/idctref.o ../MPEGORG_CODEC/src/mpeg2dec/motion.o ../MPEGORG_CODEC/src/mpeg2dec/mpeg2dec.o ../MPEGORG_CODEC/src/mpeg2dec/recon.o ../MPEGORG_CODEC/src/mpeg2dec/spatscal.o ../MPEGORG_CODEC/src/mpeg2dec/store.o ../MPEGORG_CODEC/src/mpeg2dec/subspic.o ../MPEGORG_CODEC/src/mpeg2dec/systems.o ../MPEGORG_CODEC/src/mpeg2dec/verify.o  -o "Project4.exe" -L"lib"  

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

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

Execution terminated

That error means it can not find the function cpu_features_init() in any of the file it compiled or in any of the libraries it is trying to link.

Check out those warnings -- they might actually be errors which are causing that link problem.

thanx a lot! i solved my problem - actually I don't know what was exactly.It just took me a day, of trying, and all of a sudden..

it might have been a small unintentional change to my code, who knows...:D

Hi ,
I too have face same prob. It happens when there is already mingw32 already installed on your computer.

The solution is to mingw32 from add remove problem and delete its folder from C drive.

May be u need to re install Dev and hopefully probelm will vanish

>>May be u need to re install Dev and hopefully probelm will vanish

Forget Dev-C++ because it has not been updated for quite a few years now. It's officially dead.

Get Code::Blocks with MinGW compiler (its all in one install package). You might want to uninstall Dev-C++ first.

I like the old Dev-Cpp, and still using that. I had similar problem but I could fix it withouh reinstallation. The reason in my case was a mixing with new mingw installation. In the "Compile log" window I seen that crt2.o was linked from an other location. Solution is deleting "LIBRARY_PATH" variable. Actually, I set dev-cpp to call an own made "make.bat" instead of "make.exe", and that " make.bat" has a "SET LIBRARY_PATH=" line at the top. (And this make.bat do some other tricks: it can call latest make.exe version and can compile with -j multi-thread parameters withouth problems)

I like the old Dev-Cpp, and still using thatc

I guess you like using obsolete and buggy programs :) But you could just update the MinGW compiler with newest version.

By now, I know well the few bugs in Dev-Cpp, and can manage them. Of course, new development tools and compilers are better, but I am quite sure that they have also bugs, many of them is not yet known. For my projects running in low power embedded systems, DevCpp and old Mingw and old GTK works very well, for many many years, I trust this system. If I turn into a newer envirement and compiler, then I take some risk. Anyway, I am also using the latest MinGW (just downloaded last week), but mainly for developping calculation-intensive applications.

This article has been dead for over six months. Start a new discussion instead.