I found this sample code on the msdn library
#include <iostream>
int main()
{
std::cout << "This is a native C++ program." << std::endl;
return 0;
}
from How to Compile a Native C++ Program From the Command Line I store this code in file.cpp I then go to the command prompt and type this
The output is as follows:
Current Path> cl /EHsc file.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
file.cpp file.cpp(1) : fatal error C1034: iostream: no include path set
I have the path variable set to the mirosoft sdk but I don't know what to do.
I have tried multiple files like string.h and stdlib.h, but still no luck.
The Visual C++ compiler depends on a whole bunch of environment variables. The easiest way to get these set right is using the "Visual Studio Command Prompt" item created on the Start menu during the install, or running vcvars32.bat
from the program directory.
Otherwise, you'll have to set INCLUDE=
and LIB=
variables to the proper directories before getting a successful compile.