Yep, I"m a freaking noob! I broke "Hello World"!

Pages: 12
Ok, so I installed Code::Blocks (13.12), followed the instructions here... http://www.cplusplus.com/doc/tutorial/introduction/codeblocks/ ..to the tee, copied the "Hello World" program directly from the page, pasted it in, saved it, hit F9... and it blows up! (insert bad words here!)

Under the messages I get... "fatal error: iostream: No such file or directory"

What could I have done so wrong with "Hello World"????
what operating system are you on?
Can you post the code you used?

I'm not too familiar with codeblocks, but I personally recommend visual studio express 2013 It's free and excellent.

Since I don't know the commands for codeblocks this may not be of help, but try hitting ctrl+f5. That works in visual studio.

Also, did you type your iostream include like this?

#include <iostream>
do not use Visual Studio. It will only confuse you if you're a beginnner. Microsoft Visual C++ like to default to C++/CLI (a completely different language... based off C++, but still completely different). It's also slower, and it takes up too lmuch disk space for what it's worth...

You can get better tools than MSVC++.

Code::Blocks is perfect if you're just starting.
Not to start a "which ide is better" argument, but I personally learned on visual studio and I didn't find it too difficult. I use it because the debugger is top notch and depending on your computer it should run at a fine speed.

I think the IDE you use is mostly a personal preference with each having its advantages and disadvantages.

Now back on topic, everyone here loves to help so if you post you code and tell us your operating system we should be able to help you find a solution
visual studios is a fine ide. i personally had many problems with code::blocks. but as turtlesavage said its a matter of personal preference. if you want to start a flame war the lounge would be better
Getting back to the topic, you might have named the file wrong. Make sure it is something like "main.cpp" or "helloworld.cpp", not "main.c" or "helloworld.c", which would normally cause it to be compiled as a C file rather than a C++ file. Obviously, C doesn't have the <iostream> header, which would be the cause of your problems.

I like Code::Blocks.
Last edited on
You need the header file iostream and include it in your progran
Last edited on
im sure he did that if he copied it from the site
I too started this week from the tutorial made here and got my first hello world. I am using "Dev C++ Ide"
File>New>Source File and saved it as hello.cpp. These are the exact full code it used
1
2
3
4
5
6
7
8
//my first program in c++ 
#include <iostream>

int main()
{ std::cout<< "hello world! \n"; //outputs hello world.
system ("pause"); // pauses the program until I press a key. I use the pause just to see the result. You can remove it later.
}

This is the easier version of the above using namespace
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

int main()
{ cout<< "hello world! \n"; //outputs hello world and inserts a new line.
system ("pause"); // pauses the program until I press a key. I use the pause just to see the result. You can remove it later.
}


On the menu bar, go to Execute> Compile. The compiler will create an executable called hello.exe.

To run it go to Execute>Run. Thats how i did it.
a) dev c++ is a bad ide.
b) using namespace std:: == bad. the top example is better
my friend had a problem with code::blocks. you might wanna try it installing again. if it still doesnt work, try using devc++ or visual studio. i dont wanna say which ide i think is good because that will just create a lot of unnecessary arguements but try one of them and if you dont like it try another one. and are you sure you are typing this
#include <iostream>
if not that might be the problem. also you might wanna copy and paste the code that Javaspell has given and try that.
hope i helped ....
@Little Bobby Tables
is dev c++ an IDE?
its just a compiler
Dev C++ is not a compiler.
@keskiverto
why? i thought it is. base on what i know code blocks is an IDE and a compiler as well.
while Dev C++ i just a compiler haha.
i thought The IDE is the color to distunguish the codes? bla bla bla
so really its not a compiler?
The compiler is only used to compile code. For example, MinGW is a compiler, GCC is a compiler, Clang is a compiler, etc. An IDE (Integrated Development Environment) is basically a text editor providing additional functionality, such as a 'compile' button (linked to a separate, standalone compiler), syntax highlighting, refactoring options, etc. etc. etc. Dev-C++ is an IDE, Code::Blocks is an IDE, Eclipse is an IDE.
Both Code::Blocks and Dev C++ are IDE's. Neither is a C++ compiler. Both might, as part of their default install procedure, install some C++ compiler (most likely GCC). If not, it is up to the user.
Last edited on
to expand upon what NT3 said, an ide will typically group a bunch of tools together, such as an editor, compiler, intellisense, and a debugger, hence the intergrated part. and despite what sankilk said dev c++ should not be used. it is not being updated. instead use orwell dev c++ (if you want to use an ide, and you want that ide to be dev c++)
I will cast my vote here, for visual studio. Free and easy to learn. I got my start on visual c++ 2010 but moving to VS2013 is natural and very familiar to me. It is more or less a very similar setup.

But on another note, I saw that hello world code with the auto type and have been frantically searching this site for info on it. I keep finding things about cars. Can someone point me to a link explaining 'auto'.
Last edited on
@keskiverto @NT3 @Little Bobby Tables
oh i see. so that's why my codeblocks is "codeblocks mingw" and i once,twice,thrice saw a GCC. but i have use dev c++(IDE) and code blocks mingw (COMPILER) but it both working in any code i code
Pages: 12