Author Topic: undefined reference to `___cpu_features_init'  (Read 9559 times)

?manu*

  • Guest
undefined reference to `___cpu_features_init'
« on: April 30, 2008, 10:00:39 pm »
I'm trying to pass from DevCpp to Codeblocks. I've installed from codeblocks-8.02mingw-setup. I create a new console project and try to compile it. What I get is:

C:/Programmi/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x167): undefined reference to `___cpu_features_init'

Any help?

E.

Offline grabriel

  • Single posting newcomer
  • *
  • Posts: 6
Re: undefined reference to `___cpu_features_init'
« Reply #1 on: May 05, 2008, 02:24:27 pm »
Hi,

I have the same errors i see on sevral others forum the same solution which don't match with me, but you can try it.

You need to create a new file and then C::B ask you to add this file for release and/or debug, so you select the one you want, copy paste your code in the new file and compile. Make this for all your files.
I don't find another solution or option in c::b menus to do this, or to do it on all files of the projects.

I already try this solution but i always have the undefined "reference to" error.
If it's ok for you can you tell me how you have configure your c::b.

Hope it can help you.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6957
    • My Best Post
Re: undefined reference to `___cpu_features_init'
« Reply #2 on: May 10, 2008, 04:43:31 am »
C:/Programmi/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../crt2.o:crt1.c:(.text+0x167): undefined reference to `___cpu_features_init'

I am guessing that MinGW GCC is not correctly installed. I might be wrong, but this error looks like a Windows Vista or Bad MinGW install Error.

Are you running Windows Vista? If, Yes then I suggest re-installing MinGW and hope the new MinGW works under Vista as the MinGW group said it would.

Things to do to check a Mingw GCC install

1. Is Cygwin installed; if yes, then it can not be in the windows PATH. If it is errors happen.
2. Do you have more than one copy of MinGW installed? I think DevCpp installs an copy of MinGW.
    If yes, please make sure none of them are in the Windows PATH.
    If yes, please make sure none of them is in the path X:\MinGW were X is any of your drive letters
    If No, only one copy installed it can be in the Windows PATH and installed in X:\MinGW
    ( Mingw likes to look for files in X:\MinGW if it exists so can not use that path on multiple MinGW installs)

If above fails, I suggest removing MinGW and Re-installing it.

To install I suggest, using the new MinGW installer MinGW-5.1.4.exe; pick the current release. And pick components of runtime, w32api, binutils, core, gpp/g++ and make.
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780&release_id=595197

If you want to do it manually your problem is most likely in the runtime component, so getting that installed again and verify the mingwm10.dll DLL is in your path may fix the issue. I normally copy the mingwm10.dll DLL to a folder that is always in my path, but at the end of my path.


If you wish to do more troubleshooting, you can run my MinGW info script below.

My Test Script called version-of-mingw.bat
To use, copy it into an bat file in your MinGW folder that contains the bin subfolder and run the bat file.
Code: [Select]
@echo off
REM credit to Peter Ward work in ReactOS Build Environment RosBE.cmd it gave me a starting point that I edited.
::
:: Display the current version of GCC, ld, make and others.
::

REM %CD% works in Windows XP, not sure when it was added to Windows
REM set MINGWBASEDIR=C:\MinGW
set MINGWBASEDIR=%CD%
ECHO MINGWBASEDIR=%MINGWBASEDIR%
SET PATH=%MINGWBASEDIR%\bin;%SystemRoot%\system32
if exist %MINGWBASEDIR%\bin\gcc.exe (gcc -v 2>&1 | find "gcc version")
REM if exist %MINGWBASEDIR%\bin\gcc.exe gcc -print-search-dirs
if exist %MINGWBASEDIR%\bin\c++.exe (c++ -v 2>&1 | find "gcc version")
if exist %MINGWBASEDIR%\bin\gcc-sjlj.exe (gcc-sjlj.exe -v 2>&1 | find "gcc version")
if exist %MINGWBASEDIR%\bin\gcc-dw2.exe (gcc-dw2.exe -v 2>&1 | find "gcc version")
if exist %MINGWBASEDIR%\bin\gdb.exe (gdb.exe -v | find "GNU gdb")
if exist %MINGWBASEDIR%\bin\nasm.exe (nasm -v)
if exist %MINGWBASEDIR%\bin\ld.exe (ld -v)
if exist %MINGWBASEDIR%\bin\windres.exe (windres --version | find "GNU windres")
if exist %MINGWBASEDIR%\bin\dlltool.exe (dlltool --version | find "GNU dlltool")
if exist %MINGWBASEDIR%\bin\pexports.exe (pexports | find "PExports" )
if exist %MINGWBASEDIR%\bin\mingw32-make.exe (mingw32-make -v | find "GNU Make")
if exist %MINGWBASEDIR%\bin\make.exe (ECHO It is not recommended to have make.exe in mingw/bin)
REM ECHO "The minGW runtime version is the same as __MINGW32_VERSION"
if exist "%MINGWBASEDIR%\include\_mingw.h" (type "%MINGWBASEDIR%\include\_mingw.h" | find "__MINGW32_VERSION" | find "#define")
if exist "%MINGWBASEDIR%\include\w32api.h" (type "%MINGWBASEDIR%\include\w32api.h" | find "__W32API_VERSION")

:_end
PAUSE

My Results
Code: [Select]
MINGWBASEDIR=C:\Apps\MinGW_Std
gcc version 3.4.5 (mingw special)
gcc version 3.4.5 (mingw special)
GNU ld version 2.17.50 20060824
GNU windres 2.17.50 20060824
GNU dlltool 2.17.50 20060824
GNU Make 3.81
#define __MINGW32_VERSION 3.14
#define __W32API_VERSION 3.11
Press any key to continue . . .

Tim S
« Last Edit: May 10, 2008, 05:13:56 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline techtonik

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: undefined reference to `___cpu_features_init'
« Reply #3 on: June 24, 2008, 05:16:31 am »
You probably have autodetected wrong version of GCC in your environment. This can happen if you have Dev-C++ installed. Check "Settings->Compiler and debugger...->Search directories" and "Settings->Compiler and debugger...->Toolchain executables"

Offline Hans Henrik

  • Multiple posting newcomer
  • *
  • Posts: 23