Dylan
Dylan

Reputation: 65

errors inside std files from Visual Studio

the following code

#include <vector>

void main() {
std::vector<int> testing;
testing.push_back(45);
}

is spitting a bunch of errors at me before I even build, the weird thing is, there are no errors with my file main.cpp, the errors are coming from inside vector.h (and pretty much any other std library I try to use). this code works fine in xcode on a mac, but not in visual studio 2015 on windows. I am less familiar with coding on windows so am I missing something obvious?

here are what most of the errors look like (there are hundreds like this)

Error (active)      the global scope has no "float_t"   Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    688 
Error (active)      the global scope has no "double_t"  Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    688 
Error (active)      the global scope has no "nan"   Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    700 
Error (active)      the global scope has no "acoshf"    Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    704 
Error (active)      the global scope has no "asinhf"    Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    704 
Error (active)      the global scope has no "atanhf"    Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    704 
Error (active)      the global scope has no "cbrtf" Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    705 
Error (active)      the global scope has no "erff"  Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    705 
Error (active)      the global scope has no "erfcf" Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    705 
Error (active)      the global scope has no "expm1f"    Test    c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cmath    706 

there are a number of other types of errors as well, but this is the first few lines, I can post more details if needed.

thanks!

Upvotes: 2

Views: 8651

Answers (2)

nrabbit
nrabbit

Reputation: 181

I went to Project->Properties->Configuration Properties->General and changed the Windows SDK version to the most current (it was 8.1 and I changed it to 10.0.10586.0) and it cleaned up all the errors.

Upvotes: 6

Dylan
Dylan

Reputation: 65

not sure what happened but deleting the visual studio 11-14 folders in program files and "repairing" visual studio from add or remove programs worked. I had previously tried uninstalling the whole program and reinstalling but that did not work for some reason. anyways hopefully someone will find some use from this at some point.

Upvotes: 3

Related Questions