Author Topic: Can't compile a simple program, help?  (Read 6994 times)

Offline strangecanadian

  • Single posting newcomer
  • *
  • Posts: 2
Can't compile a simple program, help?
« on: March 25, 2012, 06:52:31 pm »
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;
}

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...

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

Offline Warren

  • Single posting newcomer
  • *
  • Posts: 3
Re: Can't compile a simple program, help?
« Reply #1 on: March 25, 2012, 07:22:40 pm »
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

Offline strangecanadian

  • Single posting newcomer
  • *
  • Posts: 2
Re: Can't compile a simple program, help?
« Reply #2 on: March 25, 2012, 07:27:03 pm »
oh thank you, i fixed that but i'm still getting the same error :(

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Can't compile a simple program, help?
« Reply #3 on: March 25, 2012, 07:46:37 pm »
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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org