User forums > Help

Can't compile a simple program, help?

(1/1)

strangecanadian:
I was recommended to use codeblocks with c++ so I tried it, but every time I try to compile a simple hello world program

--- Code: ---#include <iostream>
namespace std;
int main()
{
    cout << "Hello world" << endl;
    return 0;
}

--- End code ---

Selection for new project: console application > C++ > title1 etc. > multiple compilers attempted (GNU GCC, MS visual c++ 05/08, Borland C++ Compiler) & Debug/Release configuration both checked.
I create a new empty file and save it, type the code, and when i press build I get this error in the build log

--- Quote ---"eishf - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...

--- End quote ---

I just want to compile a program, any help please?

Warren:
Hi there Canadian!
U forgot "using" before namespace std;

Like this:

#include <iostream>

using namespace std;

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

 :)
Warren

strangecanadian:
oh thank you, i fixed that but i'm still getting the same error :(

stahta01:
Install a Compiler on your Computer.
Determine where you installed the compiler
Configure Code::Blocks to use the Compiler

Before asking anymore questions read the Code::Blocks FAQs
http://wiki.codeblocks.org/index.php?title=FAQ

Tim S.

Navigation

[0] Message Index

Go to full version