Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: pranay_varma on February 23, 2007, 06:15:30 am
-
Compiling: main.cpp
Linking console executable: C:\pran\console.exe
/mingw/lib/crt2.o:crt1.c:(.text+0x16a): undefined reference to `__cpu_features_init'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
Could u let me know if there is a way out?
-
You forgot to install MinGW Runtime Libraries. That's why it's complaining. ;)
Regards,
Biplab
-
Thanks for responding.
I had done a nm *.a|grep cpu_features after sending the email
to make sure that the symbol was there in the libraries.
I ended up trying to find the library in which it was declared:
sh-3.2$ for i in *.a
> do
> nm $i|grep cpu_features > /dev/null
> if [ $? = 0 ]
> then
> echo $i
> fi
> done
libmingw32.a
libmingwex.a
I, then, manually added this library in the Linker section.
I would expect the libraries to be automatically included, especially because the thing generating the executable generating the error is in the same path.
I had also added LD_LIBRARY_PATH in the environment variable to no avail. Perhaps the linker option for library path may work. For now, I have added the library itself to the linker set of libraries.
Pranay
-
Download MinGW Runtime library from the following link.
http://prdownloads.sourceforge.net/mingw/mingw-runtime-3.11.tar.gz?download
Extract the package in C:\MinGW directory or wherever you've installed MinGW. This package comes with crt2.o and other necessary C Runtime Libraries. This will solve your problem. :)
You don't need to do any other changes after the wizard generates project file.