Menu

Strange Linker error "undefined reference to"

Anonymous
2003-12-28
2012-09-26
  • Anonymous

    Anonymous - 2003-12-28

    I created a new dev-cpp project at "e:\My Project\dev2" with the project type "C project" and project name "dev2". Then i copied a c file "quotes.c" to the project directory and added it to the project. Its contents is as follows:
    //quotes.c
    #include <stdio.h>
    #include <stdlib.h>
    #include <conio.h>
    int main(void)
    {
       char string[] = "\&quot;Stop!\&quot;, he said.";

       printf(string);
       getche();
       return 0;
    }
    When i compiled it, there was a linker error: "undefined reference to __gxx_personality_v0". But, when i change the c file name from "quotes.c" to "quotes_1.c", the project could be successfully compiled and the executable ran well. So why all this happened?

    By the way the dev-cpp version is 4.9.8.5. When i installed it tonight, i used the update utility to downloaded two packages.

     
    • Wayne Keen

      Wayne Keen - 2003-12-28

      Wayne stupid question #1 - Are you sure that you didn't have a capital C in there?  That can trip it into compiling incorrectly.

      In the future, it would be a BIG help if you would post the full compile log, and not just the errors.  The compile log is on the tab labeled "Compile Log" (I say that not to insult you, some folks try to copy the contents of the tab labeled "Compile").  The right mouse button brings up the copy menu on this tab,  Grab the contents of the compile log with your mouse, hit the right mouse button, hit copy, and paste it on in.

      Great job of posting your code and giving version information!

      Wayne

       
    • Wayne Keen

      Wayne Keen - 2003-12-28

      Oh yeah, I forgot....senile....

      It is not a good habit to get into of putting your projects in paths with spaces in them, like "My Project".  Why?  Even though Colin and team have worked hard to work around it, GCC is still a Unix ancestry tool, and Unix does not always parse spaces well.

      Two rules of thump I filllow that seem to help me.  I let Dev install where it wants, and don't put it in "Program Files" or something with a space in the path.  And then I keep my projects in a directory with no spaces in the path.

      This has nothing to do with your specific problem, but it should help you avoid some weirdness down the road.

      Wayne

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.