Thread: Compiler problem

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    150

    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!

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    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.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    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.

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    150
    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!

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dev-C++ compiler problem
    By GrasshopperEsq in forum C++ Programming
    Replies: 19
    Last Post: 05-08-2008, 02:35 AM
  2. Compiler Problem
    By sitestem in forum C++ Programming
    Replies: 2
    Last Post: 04-11-2004, 03:48 PM
  3. Replies: 5
    Last Post: 12-03-2003, 05:47 PM
  4. Problem with compiler
    By knight543 in forum C++ Programming
    Replies: 4
    Last Post: 02-09-2002, 09:16 PM
  5. Please help me with this compiler problem
    By incognito in forum C++ Programming
    Replies: 1
    Last Post: 01-05-2002, 05:14 PM