Thread: DevC++ no longer compiling, [Linker error]

  1. #1
    Registered User
    Join Date
    Apr 2008
    Location
    Australia
    Posts
    55

    DevC++ no longer compiling, [Linker error]

    EDIT: Solution found: Tools > Compiler Options > Settings > Linker > Do not use standard system startup files or libraries. End edit.


    hi,
    Just wondering if there's some thing (i.e setting?) that could be changed to fix this issue before I decide to completely reinstall DevC++;

    For whatever reason, I can now no longer compile even the most basic code without getting various [Linker error] undefined reference etc errors when trying to compile a single source file, though I previously could without issue. However, creating a project and compiling the exact same code (same location etc), everything compiles and runs fine.

    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {}
    Errors;
    Code:
    [Warning] cannot find entry symbol _mainCRTStartup; defaulting to 00401000 
    \Temp\ccGAbaaa.o(.text+0x17) In function `ZSt17__verify_groupingPKcjRKSs': 
    [Linker error] undefined reference to `std::string::size() const' 
    \Temp\ccGAbaaa.o(.text+0x135) In function `main':
    And various other, similar, errors.

    Please note: I'm only a beginner , but as I said, if I use this exact same code with a project it works fine. It's as if I've done something to DevC++ to cause this, but I can't for the life of me see how/where I would/could of done this.
    I'm using DevC++ v4.9.9.2.

    Please let me know if any other info may help.
    Last edited by Tropod; 12-22-2008 at 05:45 AM. Reason: Solution found

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Not sure what option you changed, but it's probably in Tools->Compiler Options. You surely shouldn't have anything under Linker Commands.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Location
    Australia
    Posts
    55
    Well I did make some additions to the linker command for some OpenGL tutorials I was going through, but I've since (tried &) removed all the linker commands but to no avail.


    Just as I was typing this, I got it working.....
    Tools > Compiler Options > Settings > Linker > Do not use standard system startup files or libraries.
    ggrr I do remember changing that now lol, trying to get something else to work earlier haha.


    Thanks for your input!!

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Don't forget int main () , should return 0; or an int.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by execute
    Don't forget int main () , should return 0; or an int.
    The global main function returns 0 if control reaches the end of it without encountering a return statement.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Most compilers still require you to have a return statement in a non-void function.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by execute
    Most compilers still require you to have a return statement in a non-void function.
    They should, but the global main function is an exception.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Most compilers still require you to have a return statement in a non-void function.
    This is true of any good compiler for all normal functions, but 'main' is treated special in this case as required by the standard.

    Soma

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by laserlight View Post
    They should, but the global main function is an exception.
    True, although the very few times I've used VC++ it did complain about no return statement. I feel lucky I seldomly have to use it, though...

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by EVOEx
    True, although the very few times I've used VC++ it did complain about no return statement. I feel lucky I seldomly have to use it, though...
    You probably are talking about the pre-standard MSVC6, or maybe MSVC7.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Tropod View Post
    EDIT: Solution found: Tools > Compiler Options > Settings > Linker > Do not use standard system startup files or libraries. End edit.
    That's a pretty weird "fix." I'm not sure you've addressed the root cause, here.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  12. #12
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by brewbuck View Post
    That's a pretty weird "fix." I'm not sure you've addressed the root cause, here.
    That was the problem. The fix is to not do that.

  13. #13
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    My point was, some even complain about main(). And why are we even debating or talking about this? This is like arguing about what color car is better.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

  14. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by execute
    My point was, some even complain about main(). And why are we even debating or talking about this? This is like arguing about what color car is better.
    You are right to say that this is like arguing about what colour car is better: the choice of whether to have an explicit return statement in the global main function is user preference. We are talking about this because you complained about the "missing" return statement.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    I said you need it, for certain IDEs, maybe those IDEs implemented it wrong, but it doesn't matter. And I didn't complain about it.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. [Linker Error] Unresolved external
    By Bachatero in forum C Programming
    Replies: 4
    Last Post: 05-18-2007, 11:35 PM
  3. Strange/false errors
    By Ganoosh in forum Windows Programming
    Replies: 8
    Last Post: 10-20-2005, 04:54 PM
  4. OpenGL in devc++
    By Mipix in forum Game Programming
    Replies: 5
    Last Post: 07-21-2003, 01:21 PM
  5. please help me
    By insane in forum Game Programming
    Replies: 8
    Last Post: 05-12-2003, 12:40 AM