This really puzzles me. I am runnig exacty your same code but returns errors in my computer.
In[1]:= Needs["CCompilerDriver`"]
CCompilers[]
Out[2]= {{"Name" -> "Visual Studio",
"Compiler" ->
CCompilerDriver`VisualStudioCompiler`VisualStudioCompiler,
"CompilerInstallation" ->
"C:\\Program Files (x86)\\Microsoft Visual \
Studio\\2017\\Community",
"CompilerName" -> Automatic}, {"Name" -> "Visual Studio",
"Compiler" ->
CCompilerDriver`VisualStudioCompiler`VisualStudioCompiler,
"CompilerInstallation" ->
"C:\\Program Files (x86)\\Microsoft Visual \
Studio\\2017\\BuildTools", "CompilerName" -> Automatic}}
In[3]:= hello = CreateExecutable["
// Hello100.cpp : Defines the entry point for the console \
application.
//#include \"stdafx.h\"
#include <iostream>
// i/o example
// stringstreams
#include <string>
#include <sstream>
using namespace std;
int main()
{
string mystr;
float price = 0;
int quantity = 0;
int next;
cout << \" Enter price : \";
//getline(cin, mystr);
//stringstream(mystr) >> price;
cout << \" Enter quantity : \";
//getline(cin, mystr);
//stringstream(mystr) >> quantity;
cout << \" Total price : \" << price * quantity << endl;
//cin >> next;
return 0;
}
", "hellomyfirst", Language -> "C++"]
During evaluation of In[3]:= CreateExecutable::cmperr: Compile error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory
Out[3]= $Failed
In[4]:= Import["!" <> QuoteFile[hello], "Text"]
During evaluation of In[4]:= StringJoin::string: String expected at position 2 in !<>QuoteFile[$Failed].
During evaluation of In[4]:= Import::chtype: First argument !<>QuoteFile[$Failed] is not a valid file, directory, or URL specification.
Out[4]= $Fail
I notice that you are using the the 2017 Profesional and the VS 2012. Is there anything reported from 2017 COmmunity that might limit this compilation?