C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-16-2009, 07:00 PM   #1
Registered User
 
Join Date: Mar 2006
Posts: 143
Compiler problem

This probably isn't the right board for this, but I have Dev-C++ using MinGW and I keep getting the following error:

Linker error: undefined reference to _cpu_features_init.

Does anyone know how to solve this problem? For the record, I also use Visual C++ Express and it works just fine.
__________________
HA! I WIN!
xixpsychoxix is offline   Reply With Quote
Old 01-17-2009, 01:22 AM   #2
Registered User
 
Join Date: Jun 2005
Posts: 1,343
A possible reason is that the link libraries that come with Dev-C++ are installed incorrectly. The linker needs to access a number of libraries (eg in the standard C and C++ libraries) in order to build a program and if one of these is misconfigured .....

It's also possible you have some environment variables set incorrectly, in particular things like LD_LIBRARY_PATH or similar, which the linker uses to find libraries. These are set through your IDE (eg Dev-C++) and, if so, care is needed to ensure they are correct and handle things like space characters in paths correctly. There is also an occasional inconvenience that the same environment variable can be used by different products, so the installation of one development environment might upset the working of another.
grumpy is offline   Reply With Quote
Old 01-17-2009, 01:33 AM   #3
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
IIRC,
gcc prog.cpp
will trigger it.

Try
g++ prog.cpp

That is, use the C++ compiler to compiler C++ code.

Although the compiler auto-detects the language, it won't necessarily pass on all the correct linker options to link the program successfully.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 01-17-2009, 01:41 AM   #4
Registered User
 
Join Date: Dec 2006
Posts: 1,780
I remember it's due to something very stupid... (needed to use it at my school)

Something like running 2 instances of Dev-C++, if not I don't remember. But I guarantee that when you found out the cause you will feel like smashing your head against the nearest wall.
cyberfish is offline   Reply With Quote
Old 01-17-2009, 07:12 AM   #5
Registered User
 
Join Date: Mar 2006
Posts: 143
well, i have another version of MinGW installed besides just the one for Dev. I installed it some time ago. I also have DJGPP installed, which i think i remember may be very similar to MinGW? anyways, i'll try some more stuff and if anyone has any more ideas, please let me know
__________________
HA! I WIN!
xixpsychoxix is offline   Reply With Quote
Old 01-17-2009, 12:46 PM   #6
Registered User
 
Join Date: Dec 2006
Posts: 1,780
Quote:
well, i have another version of MinGW installed besides just the one for Dev.
YES, THAT'S IT!

Rename it or delete it or take it out of $PATH. Dev-C++ is getting confused.

I had my own copy of MinGW, and then installed Dev-C++ for my schoolwork, and it didn't like that.
cyberfish is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dev-C++ compiler problem GrasshopperEsq C++ Programming 19 05-08-2008 02:35 AM
Compiler Problem sitestem C++ Programming 2 04-11-2004 03:48 PM
C / OpenGL help REALLY needed for simple but annoying problem! Oz_joker C Programming 5 12-03-2003 05:47 PM
Problem with compiler knight543 C++ Programming 4 02-09-2002 09:16 PM
Please help me with this compiler problem incognito C++ Programming 1 01-05-2002 05:14 PM


All times are GMT -6. The time now is 03:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22