Jump to content
  • Advertisement
Sign in to follow this  
Simpsons4261

Question for starting projects in VC++ Express

This topic is 3982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
When I try to compile my project, I get the error:

------ Build started: Project: hi world, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\documents and settings\kyle\my documents\visual studio 2005\projects\hi world\hi world\main.cpp(1) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
Build log was saved at "file://c:\Documents and Settings\Kyle\My Documents\Visual Studio 2005\Projects\hi world\hi world\Debug\BuildLog.htm"
hi world - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Are you including it like this?

#include <iostream> // Note the brackets <> and no *.h

The brackets <> tells the preprocessor to look into the directory
paths set by the PATH compilier settings, which normally includes
the standard library.

If the above gives the same error, something may be wrong with your
compiliers' path settings.

In C++, it is recommend to use <iostream> instead of <iostream.h>

Share this post


Link to post
Share on other sites
I switched it to just regular iostream instead of iostream.h and got this...

------ Build started: Project: hi world, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\documents and settings\kyle\my documents\visual studio 2005\projects\hi world\hi world\main.cpp(5) : error C2065: 'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\Kyle\My Documents\Visual Studio 2005\Projects\hi world\hi world\Debug\BuildLog.htm"
hi world - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Do I have to download that Microsoft Platform SDK cuz I dont have that right now?

my code right now is:

#include <iostream>

int main ()
{
cout << "Hello World!\n";
return 0;
}

Share this post


Link to post
Share on other sites
Try this:

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!\n";
return 0;
}


"cout" is part of the std namespace. Adding using namespace std
includes this namespace so the compilier can see what "cout" is.

Share this post


Link to post
Share on other sites
Okay that worked, this tutorial I'm using must suck or something...

http://newdata.box.sk/bx/c/

Do you think I should keep using that or should I use something else? Recommendations?

Also, should I download the MS Platform SDK for VC++ Express?

Share this post


Link to post
Share on other sites
Use some other tutorial. That one doesn't follow the latest supported C++ Standards. You'll receive countless headaches trying to enter code which wont compile, while also learning deprecated syntax.

Cheers!

Share this post


Link to post
Share on other sites
I personally recommend This site

Direct link to the tutorial

This contains a nice set of beginning C++ tutorials and refrence.

Also, do not worry about the Win32 PSDK until you are ready for it.
For now, focus on learning the language itself. Once you get more
experienced--and are still with C++--then try it out[smile]

Dont run before you can walk[smile]

Whatever you choose though, good luck!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!