Hello,
As you could probably guess I am new to C++ programming. I have a very simple problem that I i tried to look up. My problem is: when i try to compile a .ccp file with the code:
1 2 3 4 5 6 7 8 9 10
// my first program in C++
#include <iostream>
usingnamespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
and i get tge following errors:
Unable to open include file 'iostream'
Namespace name expected
undefined symbol 'cout' in funtion main()
Why is it giving me these errors?
How can I fix these?
I have the Borland compiler 5.5
Windows Vista Ultimate SP2
That page lists the way you add the compiler to environment variables at bottom of page.
very easy, just open up the directory including the borland compiler click in the address window and copy the path, then go to control panel -> system -> advanced, click the environment variables button, scroll down the second box frame, till you see PATH click path and click edit, then a bunch of selected text will pop up in small frame. don't delete this just push the arrow key or something append ';' to the end then paste (ctrl v) the path of borland to the end and then click ok, ok, ok, and your done.
Even though i did not follow it the begining it didn't help when i did it. I double checked to make sure i did everything on that page right to. As for another compiler i tried Microsoft C++ express I believe and it gave me about the same errors.
Whatever you did, you don't have the iostream header. You need to get it. If whatever you are using didn't come with it, either you did something is wrong or something is up.
There's nothing wrong with the code, it's the compiler so ignore foncused and Zhuge.
one nz
did you try bazzy's suggestion?
Do this one last thing if it doesn't work, then unfortunately I won't be able to help you, someone more experienced will have to try and solve your problem.
It's quite a nice IDE from what I have seen but I don't use it, personally I use Unix not Windows so I can only give basic advice. DevCpp is free, and should have good resources available.
So go try that please, and post back here if unresolved and someone else might be able to help.
otherwise if it works fine, please mark post as solved.
Or what you can do is add DevCpp folder path to path variables and have the command prompt open as well, and just run the executable you make by changing directory to the path where you save the file and type
I didn't say there was anything wrong with the code. I said it can't find the iostream header. It is probably, as you mentioned, a path variable issue of some kind.
...Though Dev-C++ is old, it should handle this fine and it's a bit *newer* if you simply redirect the IDE to use your own MinGW installation. It's not like the latest Code::Blocks official release is that much better although the SVN or so called Night Releases (given out once a month....wtf) are considered newer releases.
Out of all reality, only small functionality has been added to Code::Blocks over Dev-C++. And although currently Dev-C++ isn't considered to far behind, it's production has completely stopped. It either needs to be updated (I wish I could figure out the Delphi environment he used...) or you need to move on to something that gets updated at least once every two years. Rofl @ C:B.