Hi just new to programming in C++ Any reason I keep getting this linker error with Dev C++ 188.8.131.52. [linker error] undefined reference to 'cpu_features_init' Id returned 1 exit status
Clifford,To check the local variables is where in the Dev C++ program?
Thanks for all the help
I don't have Dev-C++ installed, but I believe Tools->Compiler->Options->Directories->Binaries. These paths are appended to the the PATH hen a build is initiated. By default it has just one c:\dev-cpp\bin, the problem occurs when teh PATH already has another GNU toolchain path (or even a path to something with identical executable names, like Borland's make.exe for example).
here is the compiler log in regards to the example "Hello".
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Examples\Hello\Makefile.win"
make.exe -f "C:\Dev-Cpp\Examples\Hello\Makefile.win" all
g++.exe Hello.o -o "Hello.exe" -L"C:/Dev-Cpp/lib" -lobjc -mwindows
/mingw/lib/crt2.o(.text+0x167):crt1.c: undefined reference to `__cpu_features_init'
collect2: ld returned 1 exit status
make.exe: *** [Hello.exe] Error 1
The most common cause of this problem is the existance of an alternative conflicting GNU tool chain in the system path.
When Dev-C++ runs it appends the binary path to the Dev-C++ MinGW/GCC installation to the local PATH environment variable. Unfortunately this is a bug; it should prepend the path. As a consequence if you have a path to an alternative GNU toolchain (such as Cygwin or Djpp) in your system path, it will override the one set by Dev and and cause conflicts.
Thanks for the info Clifford... I downloaded a another version of mingw. then these conflicts came to light after I already had installed dev c++ , so you are correct in thinking there is a conflict.I deleted the first version on dev c++, then uninstalled the mingw and all components and proceeded to download and installed dev c++ again, so the problem and conflicting files lie in the operating system files do you think this a correct assumption?
> do you think this a correct assumption?
No; I have no idea how you drew that conclusion when I already explained the problem. It is the PATH environment variable that was causing the problem and Dev-C++'s appending rather than prepending its environment.
The OS and applications use environment variables for a number of things. The PATH variable lists locations where the OS will search for executable files, so that for example if you run "notepad", it will search folders specified in PATH in turn until it finds an executable notepad.exe (or notepad.bat or a number of other executable file extensions).
Because Dev-C++ uses MinGW as its compiler, if you have two installations, they will have at least some executables with identical names. The one which runs will be the one that appears in the PATH first. Because the compiler toolchain actually comprised a number fo executables, it is possible (likely in fact) that you are using executables and other files from one installation with those from another installation and they are not compatible.
The simple solution would have been to remove your separate MinGW installation (although in fact you only needed to modify the PATH environment variable), or install the IDE only Dev-C++ distribution and configure it to use your existing MinGW installation. You can also set the executable paths explicitly in the Dev-C++ configuration to prevent reliance of the PATH. In Vista you have to do that in any case for other reasons.
If you want to see what environment variables are set in your system, open a command console and enter the "set" command. If you want to show just the path variable, enter "path".
Although you can modify environment variables from a command console, they are only set for the duration of the console session. This is what Dev-C++ does when it temporarily modifies the environment for a build - but as I said it appends the PATH, so any matching executable that appears before hand runs instead. To set the environment globally and permanently Start->Control Panel->System (with Control Panel "classic view")->Advanced->Environment variables.
Clifford the path environment under advanced is as follows...C:\Windows\system32;C\Windows;C\Windows\System32\Wbem;c:\Program Files\Microsoft SQL Server\90\Tools\binn the question is ; how to modify the environment.I am new to this and don't want do something that I shouldn't do properly.
If you have already removed the second copy if MinGW (and the path you posted indicates you have, and that it cleaned up) you need not worry.
However did you check both the system and the local variables? You can have a path in both.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.