Thread: Code::Blocks run problem

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Possible reasons.

    1. It doesn't compile, because there is no compiler.
    Download binary
    codeblocks-10.05-setup.exe 27 May 2010 23.3 MB BerliOS or Sourceforge.net
    codeblocks-10.05mingw-setup.exe 27 May 2010 74.0 MB BerliOS or Sourceforge.net
    The first time you download, you need the larger one including the mingw setup.
    If you then want the latest IDE (only), then you can just get the smaller one.

    2. It compiles, but the console disappears too quickly to see anything.
    There's a FAQ on this.
    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.

  2. #17
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Quote Originally Posted by Salem View Post
    Possible reasons.

    1. It doesn't compile, because there is no compiler.
    Download binary
    codeblocks-10.05-setup.exe 27 May 2010 23.3 MB BerliOS or Sourceforge.net
    codeblocks-10.05mingw-setup.exe 27 May 2010 74.0 MB BerliOS or Sourceforge.net
    The first time you download, you need the larger one including the mingw setup.
    If you then want the latest IDE (only), then you can just get the smaller one.

    2. It compiles, but the console disappears too quickly to see anything.
    There's a FAQ on this.
    Well, the mingw may be the solution.
    Quote Originally Posted by laserlight View Post
    You are not telling the truth because...


    My example prints "Hello world!"

    Obviously, you did not take my advice. I told you to create a new project. You don't have to do that if you can confirm that you have successfully used your IDE to build a C++ program, but you neglected to say anything about that.

    Basically, I am trying to rule out possible problems. Your failure to cooperate is just costing you time.
    Well, YOUR example, not mine. It's not that my failure to cooperate costs me time, it's that your failure to understand the problem is costing to me, and you, and anyone else that wants to really help.

    I'll try the mingw.
    Last edited by Coga1900; 09-06-2011 at 11:51 AM.

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Coga1900
    Well, YOUR example, not mine.
    You wrote:
    Quote Originally Posted by Coga1900
    That is the main.cpp!!!! It does nothing!
    Therefore, you stated that your claim that "it does nothing" was with reference to my example, not yours.
    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

  4. #19
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Well, count it a a typo.

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Coga1900
    Well, count it a a typo.
    Then please be more careful. However, regardless of this typo error...

    Quote Originally Posted by Coga1900
    It's not that my failure to cooperate costs me time, it's that your failure to understand the problem is costing to me, and you, and anyone else that wants to really help.
    This misses the point: I fail to understand because you did not convey the details needed to understand. This is not your fault because you cannot be expected to know what is needed. However, when you do not follow my instructions and give appropriate feedback, how am I supposed to get the information needed to help?

    Notice that Salem's post #16 presents two possibilities. If you had followed my instructions, it is possible that one of them could have been ruled out.
    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. #21
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Well, sunshine, just hear out:
    1)I'm Greek. I am not from England. I almost expected to have a grammar error.
    2)I have tried both of Salem's solutions and none of them worked.
    3)Of cource you don't understand the problem, as from a point and after you are just trying to correct me about pointless mistakes( or things you think they are mistakes.)
    4)I think we should stop this rooster fight.

  7. #22
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Coga1900
    I have tried both of Salem's solutions and none of them worked.
    Before we rule them out, I want to be sure that you tried them correctly.

    1. Create a new Code::Blocks project.

    2. In the main.cpp file (or whatever the initial source file was named), enter this program:
    Code:
    #include <iostream>
    
    int main()
    {
        std::cout << "Hello world!" << std::endl;
        std::cin.get(); // Pause by waiting for input in case it is needed.
    }
    Do not add any other code, headers or source files.

    3. Build the project. What does Code::Blocks report?

    4. Run the program. What output do you see?
    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. #23
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I have tried both of Salem's solutions and none of them worked.
    But you haven't shown us what you did, what error messages you got or anything that might help us to figure out where you're going wrong.
    Code::Blocks run problem-screenshot-main-cpp-[simple]-code-blocks-10-05-png
    Under the build menu, there is a build command.
    Selecting this should cause things to appear in the build log.
    Do you see "Compiling..." and "Linking..." or a bunch of error messages?
    Check the other tabs as well, do they contain anything that might be relevant?

    Explain your steps and post some evidence of what you see.

    Don't just keep coming back to us with the same old "it doesn't work" every time.
    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.

  9. #24
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Answer to Laserknight
    Of cource, I'm not able to rule out a possibility. Well I tried it, it reports nothing at both build and run.

    Answer to Salem
    Wait, what is that menu under the code? I don't have it.

  10. #25
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Coga1900
    Well I tried it, it reports nothing at both build and run.
    It should report something after the attempted build, just that you need to find the report, as you noted in your reply to Salem. Try looking through the IDE settings to see if you can add/enable a log window or something like that.
    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. #26
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Okay. Where are the IDE settings?
    Com on now, somebody?
    Last edited by Coga1900; 09-07-2011 at 06:56 AM.

  12. #27
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Someone?

  13. #28
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    View -> Logs
    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

  14. #29
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by stahta01 View Post
    FAQ - CodeBlocks

    Did you try turning "full Compiler logging" the directions in the link above?

    Edit: If you have enable "full Compiler logging" what did Code::Blocks output?

    Tim S.
    Q: How do I troubleshoot an compiler problem?

    A: I would start by turning on full Compiler logging.

    This is done by selecting the "Full command line" option Under menu "Settings" -> "Compiler and Debugger" -> Global compiler settings -> [the compiler you use] -> "Other Setting" tab, "Compiler logging".

    This option will make Code::Blocks output the exact commands it uses to compile your code.

    Things to remember:

    You should review all the commands and their options;
    If you don't know what an option or a command does please read the documentation for the compiler/linker you're using;
    Look for missing commands;
    For every source file (.cpp; .c; .d; etc) in your project, you must have at least one command in the log. This command must produce an object file (file extension ".o" if using gcc/g++ and ".obj" if using Visual Studio);
    Every object file should be linked in the final executable, if not there are undefined symbols errors;
    Remember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file.
    Tim S.

  15. #30
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Someone?
    Post a picture!
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 17
    Last Post: 07-08-2011, 07:11 AM
  2. Help with code::blocks
    By Souradeep in forum C++ Programming
    Replies: 6
    Last Post: 12-22-2010, 03:48 AM
  3. compilation problem........code::blocks...
    By Souradeep in forum C++ Programming
    Replies: 3
    Last Post: 12-20-2010, 03:04 AM
  4. Code Blocks compiling problem
    By Lehsyrus in forum Tech Board
    Replies: 2
    Last Post: 07-13-2010, 02:28 PM
  5. Code::Blocks problem
    By eaane74 in forum C++ Programming
    Replies: 6
    Last Post: 05-24-2007, 07:24 PM