Epic fail by me

Posts 1–15 of 19 · Page 1 of 2
Epic fail by me
Epic fail by /me

Explanation:

I'm following a tut on how to create a 'Hello World' in C++... I know half of you are like
"How can you fuck that up?" Dx Well, I managed to. I'm not positive what the issue is
But I'm getting an error: Error 1 fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory c:\Documents and Settings\Phil\My Documents\Visual Studio 2008\Projects\HelloWorld\HelloWorld\HelloWorld.cpp 4

Code:
#include <iostream.h>

int main()
{
	cout << "Hello World!\n";
	return 0;
}
File Name: HelloWorld.cpp
Compiler: Microsoft Visual C++ Express 2008

Can't believe I messed up on just this tiny project >

Anyways, hopefully someone will be able to help me
Take out the ".h" from "<iostream.h>", so it's just:

#include <iostream>

For a preprocessor directive.
Quote Originally Posted by Lolland View Post
Take out the ".h" from "<iostream.h>", so it's just:

#include <iostream>

For a preprocessor directive.
Much appreciated for the quick response
/Thanked
But now It won't allow me to compile
Apologies for the... Complications xP
iostream is a libary that work on the standard way(way=namespace) (std=standard), every libay that doesnt work that way has the (.h) at the end , that why when you will see (include<windows.h>) and the user used a functions from the (windows.h) he altought used the ("using namespce std;")
lets say that everything that ISNT std ' the compiler read it in other way , or he dont read it at all and he tell the user that there was a problem in compiling this program !
I m a C++ hacker , but , i geuss you have a book of C or C++ in your home !
that books are telling you (almost all of the book) a functions from 1-3 libarys , my tip is you to learn it But to be consetret on how does the C and C++ work (?) !
i mean , if you want to know a knew things you may go to other libarys and search there for a new functions , you have to read EVERY line to know what they did in the other line ! (that other line could be in the more 1000 lines , )
its hard but good luck with it
Is it showing an error?

Are you seeing anything?

Is the console flashing just once?
Quote Originally Posted by Lolland View Post
Is it showing an error?

Are you seeing anything?

Is the console flashing just once?
None of the above :|

The 'Start Debugging' button is greyed out

I'm not sure what caused it, but it's fine now o.o
right click the project and select Rebuild =)
I have another question, I was told to follow a 'book' "Teach yourself C++ in 21 Days" I chose this path since I can't take any classes for this at my local shool... So, I chose to do this in replacement of person to person lessons.

Anyways, I'm following this guide and It's telling me to type in code and compile it... Well... I dunno what type of project I should create to add the .cpp file to it... It seems I can't build/debug/compile without an actual project..

Code:
1: #include <iostream.h>
2: int main()
3: {
4: int x = 5;
5: int y = 7;
6: cout "\n";
7: cout << x + y << " " << x * y;
8: cout "\n";
9:return 0;
10: }
Idk what to do :|
Quote Originally Posted by Alroundeath View Post
I have another question, I was told to follow a 'book' "Teach yourself C++ in 21 Days" I chose this path since I can't take any classes for this at my local shool... So, I chose to do this in replacement of person to person lessons.

Anyways, I'm following this guide and It's telling me to type in code and compile it... Well... I dunno what type of project I should create to add the .cpp file to it... It seems I can't build/debug/compile without an actual project..

Code:
1: #include <iostream.h>
2: int main()
3: {
4: int x = 5;
5: int y = 7;
6: cout "\n";
7: cout << x + y << " " << x * y;
8: cout "\n";
9:return 0;
10: }
Idk what to do :|
1. That code is far off, if you got that right out of your book I advise you to stop reading it immediately
But by juding on how to code looks however I think you missed something
Maybe the book made a header 'iostream.h' and you missed it somehow
If that isn't te case, return to 1

good luck
Quote Originally Posted by Alroundeath View Post
I have another question, I was told to follow a 'book' "Teach yourself C++ in 21 Days" I chose this path since I can't take any classes for this at my local shool... So, I chose to do this in replacement of person to person lessons.

Anyways, I'm following this guide and It's telling me to type in code and compile it... Well... I dunno what type of project I should create to add the .cpp file to it... It seems I can't build/debug/compile without an actual project..

Code:
1: #include <iostream.h>
2: int main()
3: {
4: int x = 5;
5: int y = 7;
6: cout "\n";
7: cout << x + y << " " << x * y;
8: cout "\n";
9:return 0;
10: }
Idk what to do :|
I advise you to start using Dev C++ at the beginning. you only have to use 1 button to make a new file and 1 button to compile.
visual-C++ almost requires a tutorial itself
Are you using MSVC++ or Dev-CPP?
on MSVC++ create an empty win32 console app, then rightclick on the source folder and hit add new item to create a new .cpp file

On Dev-CPP I believe it's file->new project ->console project, but i'm not sure as I never use Dev-CPP
Quote Originally Posted by Alroundeath View Post


Much appreciated for the quick response
/Thanked
But now It won't allow me to compile
Apologies for the... Complications xP


I alway's use:

#include <iostream>
using namespace std;

That works

____

Open dev c++, then click one ctrl + n
You can debug and comp with f9
std::cout <<
Global namespace dosn't contain 'cout'
If you are using MSVC++ just keep with it, there is nothing wrong with it. and it is the best compiler...
Plus, you should include your namespace there just like someone said already.

using namespace std; (this after #include <iostream>)

or

std::cout << etc etc
Quote Originally Posted by Hell_Demon View Post
Are you using MSVC++ or Dev-CPP?
on MSVC++ create an empty win32 console app, then rightclick on the source folder and hit add new item to create a new .cpp file

On Dev-CPP I believe it's file->new project ->console project, but i'm not sure as I never use Dev-CPP
Microsoft Visual C++

Quote Originally Posted by schim View Post
1. That code is far off, if you got that right out of your book I advise you to stop reading it immediately
But by juding on how to code looks however I think you missed something
Maybe the book made a header 'iostream.h' and you missed it somehow
If that isn't te case, return to 1

good luck
Err... Not exactly sure what a header is, as it hasn't explained it in this book :|

Quote Originally Posted by 'Bruno View Post
If you are using MSVC++ just keep with it, there is nothing wrong with it. and it is the best compiler...
Plus, you should include your namespace there just like someone said already.

using namespace std; (this after #include <iostream>)

or

std::cout << etc etc
once again, almost clueless about what you said.
If anyone has a better book I could download or read online, that would be great.
Because as far as I've read on this thread, I shouldn't be looking for guidance to
a book that can't show me what I need to know for the basics.


Anyway, I appreciate the comments =D
Posts 1–15 of 19 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us