Running fails in Code-Blocks

0

My system is Window 7. I'm using CodeBlocks. I run my hello world program again and again. The error messages as following always appear. Any idea for solving this problem?

enter image description here

Jack

Posted 2012-03-04T04:34:39.960

Reputation: 231

Answers

3

The problem is not Code::Blocks. The problem is your C++ code is incorrect.

return0; is not valid C++ code to the best of my knowledge. It should be return 0;. Most likely it was a build error (syntax error). Look down the bottom of the screen for Build Messages. Screenshot w/ build error Click for full size

The default "Console project" in Code::Blocks should work, try that too.

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

Bob

Posted 2012-03-04T04:34:39.960

Reputation: 51 526

Ah, sorry for the mistake. My code indeed is originally wrong. However, same message appears after I fix it and run the code. – Jack – 2012-03-04T05:24:32.590

Try pressing F9, Build & Run. If you just run without building, the message should appear if no build has been done since the code was last changed. Do you see any other messages in the log? – Bob – 2012-03-04T06:35:09.273

1Did you download Code::Blocks with MingW? If you did not, you should have installed a compiler separately. To be sure it's not something wrong with your installation of Code::Blocks, try this: File > New > Project, Console application. Next > C++ > Next > Choose a title/location > GNU GCC Compiler (should be default) > make sure at least Debug configuration is checked. Once the project loads, press F9. – Bob – 2012-03-07T03:55:20.150

1

That is not an error message. The program must be built before it can be run.

soandos

Posted 2012-03-04T04:34:39.960

Reputation: 22 744

The problem is that, I built it again and again, and this message still appears. How can I deal with it? – Jack – 2012-03-04T04:38:24.730