User forums > Help

Hello World Fail

(1/1)

zhousama:
Hello,

I'm just starting to learn C++ and installed Codeblocks. I copied the HelloWorld program but immediately get an error:
C:\Users\...\New folder\Untitled5.c|2|fatal error: iostream: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

This is the program:
// my first program in C++
#include <iostream>

int main()
{
  std::cout << "Hello World!";
}

I'm think the error lies in the standard libraries not being included in the build path, but I'm not sure which directories to include. Any ideas?

Thanks in advance!

BlueHazzard:
you are trying to compile a c++ program with a c compiler. C::B looks at the file ending to get the right compiler. So if you want to compile a c++ program  (iostream) your file needs the cpp or cxx ending and not c.

greetings

PS. please use code tags for log and code in this forum

quneur:
int main requires a return type.

stahta01:
BlueHazzard is correct in the cause.

FAQ related to this issue is http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.

Navigation

[0] Message Index

Go to full version