Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 400
Dylan Avatar asked Jul 12 '26 14:07

Dylan


2 Answers

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.

like image 102
nrabbit Avatar answered Jul 14 '26 03:07

nrabbit


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.

like image 20
Dylan Avatar answered Jul 14 '26 04:07

Dylan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!