Take out the ".h" from "<iostream.h>", so it's just:
#include <iostream>
For a preprocessor directive.
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
File Name: HelloWorld.cppCode:#include <iostream.h> int main() { cout << "Hello World!\n"; return 0; }
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.
Alroundeath (06-28-2010)
Is it showing an error?
Are you seeing anything?
Is the console flashing just once?
right click the project and select Rebuild =)
Ah we-a blaze the fyah, make it bun dem!
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
If you wanna see how to make a someone dumb press here
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..
Idk what to do :|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: }
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
Ah we-a blaze the fyah, make it bun dem!
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
std::cout <<
Global namespace dosn't contain 'cout'
[IMG]https://i234.photobucke*****m/albums/ee320/silent712/Shad0w1-1.png[/IMG]
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
Light travels faster than sound. That's why most people seem bright until you hear them speak.
Microsoft Visual C++
Err... Not exactly sure what a header is, as it hasn't explained it in this book :|
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