Thread: Code::Blocks run problem

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    24

    Unhappy Code::Blocks run problem

    Hello. I am trying to compile, build and run some codes, but they just won't run. It can't be from a wrong code, because I even tried the main.cpp. Nothing worked. What should I do?

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    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.
    Last edited by stahta01; 09-04-2011 at 10:59 AM.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Heh, excuse me... What is full compiler logging?

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Coga1900 View Post
    Hello. I am trying to compile, build and run some codes, but they just won't run. It can't be from a wrong code, because I even tried the main.cpp. Nothing worked. What should I do?
    Maybe your program runs and finishes so quickly that you can't see. Try putting a cin.get(); in the line before return if you already haven't.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by Coga1900 View Post
    Heh, excuse me... What is full compiler logging?
    Did you try to follow the link?
    If not, follow it.

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

  6. #6
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    Okay, I put the cin.get(); (I hadn't thought of that, even than I knew about it) but it still won't build. When I build or "build and run", it does nothing, and if I try run, it says "It seems that your program hasn't been built yet. Do you want to build it now?" and if I press Yes, it still does nothing.

    Quote Originally Posted by stahta01 View Post
    Did you try to follow the link?
    If not, follow it.




    Tim S.
    What link?
    Last edited by Coga1900; 09-04-2011 at 11:33 AM.

  7. #7
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Okay, I put the cin.get(); (I hadn't thought of that, even than I knew about it) but it still won't build. When I build or "build and run", it does nothing, and if I try run, it says "It seems that your program hasn't been built yet. Do you want to build it now?" and if I press Yes, it still does nothing.
    I have a suspicion that you only installed the ide, not the compiler, if on windows.

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    This link "http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_co mpiler_problem.3F"

    http://wiki.codeblocks.org/index.php...ler_problem.3F
    Last edited by stahta01; 09-04-2011 at 01:10 PM.

  9. #9
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    I tried it, but it still does the same. But this time, when I press No, it gets a program window that says that it returned 0 value! I know that I'm tiring you, but I'm tired of all this, too!

  10. #10
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    it gets a program window that says that it returned 0 value!
    That is your program running ! Put in some output statements to see what happens.

    If you get tired of this, wonder what you'll do in future, facing segfaults !

  11. #11
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    You don't get it. It returns 0 value, but it gets no text! There is a cout, but it only returns the value! Nothing else!

  12. #12
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Paste the output of the terminal here.

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Quote Originally Posted by Coga1900
    Hello. I am trying to compile, build and run some codes, but they just won't run. It can't be from a wrong code, because I even tried the main.cpp. Nothing worked. What should I do?
    Your reasoning does not follow: just because a file is named "main.cpp" does not mean that it is immune from containing "wrong code".

    Have you ever successfully compiled and run a program using Code::Blocks? If not, create a new project and attempt to compile and run this program:
    Code:
    #include <iostream>
    
    int main()
    {
        std::cout << "Hello world!" << std::endl;
    }
    Then tell us what happened.
    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. #14
    Registered User
    Join Date
    Sep 2011
    Posts
    24
    That is the main.cpp!!!! It does nothing!

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Quote Originally Posted by Coga1900
    That is the main.cpp!!!!
    You are not telling the truth because...

    Quote Originally Posted by Coga1900
    It does nothing!
    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.
    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

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