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
As with other platforms, iostream is in the C++ standard library. The library itself is located in /usr/lib and the headers for the library are included with Xcode (see /Applications/Xcode. app/Contents/Developer/Toolchains/XcodeDefault. xctoolchain/usr/include/c++/v1/iostream).
The iostream library is part of the c++ standard library. If you're using vs, just install the c++ feature or directly install the visual c++ redistributable package. Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not.
iostream is a header file that provides declarations and prototypes that are an interface to part of the C++ standard library.
You can use <cstdio> instead of <iostream> , if you just need to output text. To print a string without formatting, you can use puts . Use printf to print with format and conversion specifiers.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With