JaxDragon
JaxDragon

Reputation: 89

Visual Studio 2010 can't find iostream

I just installed Visual Studio 2010, and wanted to test it out by writing a hello world application.

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!" << endl;

    return 0;
}

After trying to compile this I get this error

error C1083: Cannot open include file: 'iostream': No such file or directory

Here are my visual studio include directories

$(VCInstallDir)include; $(VCInstallDir)atlmfc\include; $(WindowsSdkDir)include; $(FrameworkSDKDir)\include;

And my library directories

$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib

Upvotes: 8

Views: 22103

Answers (3)

the_mandrill
the_mandrill

Reputation: 30842

If you are unable to build a simple hello world application then it suggests that either Visual Studio or the Windows SDK isn't installed correctly. Have you downloaded and installed the Windows SDK? (note: if you need to build for XP you might need to use the Win7 SDK instead)

I seem to recall that after installing the Windows SDK you may need to 'integrate' it for use with VS2010. Each version of Visual Studio can have a different default SDK that it builds against. You may need to run the SDK Configuration Tool to register it for use with VS2010. Alternatively, you might need to check the 'Platform Toolset' settings in the project, as described here

Ultimately, once that is correctly setup then you should be able to build simple C++ apps without any further configuration.

Upvotes: 2

IND000
IND000

Reputation: 29

Go through the normal easy process of creating a new Project --> Templates: Visual C++ --> Win32 Console Application. If not, search your HDD for iostream and set the include path manually.

Upvotes: -1

IndieProgrammer
IndieProgrammer

Reputation: 587

The pages given below may help you:

1.) http://msdn.microsoft.com/en-us/library/8z9z0bx6.aspx

2.) http://msdn.microsoft.com/en-US/library/hdkef6tk.aspx

<iostream> is normally stored in the C:\Program Files\Microsoft Visual Studio 10\VC\include folder. First check if it is still there.

the /P compiler option is uese to preprocess helloWorld.cpp(say),this will generate helloWorld.i, and then you check to see where iostream is getting included. and the builded log should be helpful as well as using the /showincludes option to show the paths to the include files.

Upvotes: 0

Related Questions