Iostream in Visual Studio 2015 - c++

I am a beginner c++ programmer, and have recently upgraded to windows 10 and installed the new Visual Studio 2015. However whenever I use iostream
#include <iostream>
and attempt to compile the code, it returns 289 Errors. From my understanding cmath, and math.h are conflicting with re definitions. Here is the entirety of the code in my program:
#include <iostream>
int main() {
return(0);
}
And when this is run, the output from Visual Studio 2015 is:
1>------ Build started: Project: Test, Configuration: Debug x64 ------
1> main.cpp
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(33): error C2995: '_Ty _Pow_int(_Ty,int) throw()': function template has already been defined
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1013): note: see declaration of '_Pow_int'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(36): error C2084: function 'double abs(double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1025): note: see previous definition of 'abs'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(41): error C2084: function 'double pow(double,int) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1027): note: see previous definition of 'pow'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(46): error C2084: function 'float abs(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1029): note: see previous definition of 'abs'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(51): error C2084: function 'float acos(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1031): note: see previous definition of 'acos'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(56): error C2084: function 'float acosh(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1033): note: see previous definition of 'acosh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(61): error C2084: function 'float asin(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1035): note: see previous definition of 'asin'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(66): error C2084: function 'float asinh(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1037): note: see previous definition of 'asinh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(71): error C2084: function 'float atan(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1039): note: see previous definition of 'atan'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(76): error C2084: function 'float atanh(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1041): note: see previous definition of 'atanh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(81): error C2084: function 'float atan2(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1043): note: see previous definition of 'atan2'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(86): error C2084: function 'float cbrt(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1045): note: see previous definition of 'cbrt'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(91): error C2084: function 'float ceil(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1047): note: see previous definition of 'ceil'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(97): error C2084: function 'float copysign(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1049): note: see previous definition of 'copysign'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(102): error C2084: function 'float cos(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1051): note: see previous definition of 'cos'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(107): error C2084: function 'float cosh(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1053): note: see previous definition of 'cosh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(112): error C2084: function 'float erf(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1055): note: see previous definition of 'erf'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(117): error C2084: function 'float erfc(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1057): note: see previous definition of 'erfc'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(122): error C2084: function 'float exp(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1059): note: see previous definition of 'exp'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(127): error C2084: function 'float exp2(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1061): note: see previous definition of 'exp2'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(132): error C2084: function 'float expm1(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1063): note: see previous definition of 'expm1'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(137): error C2084: function 'float fabs(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1065): note: see previous definition of 'fabs'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(142): error C2084: function 'float fdim(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1067): note: see previous definition of 'fdim'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(147): error C2084: function 'float floor(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1069): note: see previous definition of 'floor'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(153): error C2084: function 'float fma(float,float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1071): note: see previous definition of 'fma'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(158): error C2084: function 'float fmax(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1073): note: see previous definition of 'fmax'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(163): error C2084: function 'float fmin(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1075): note: see previous definition of 'fmin'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(168): error C2084: function 'float fmod(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1077): note: see previous definition of 'fmod'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(173): error C2084: function 'float frexp(float,int *) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1079): note: see previous definition of 'frexp'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(178): error C2084: function 'float hypot(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1081): note: see previous definition of 'hypot'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(183): error C2084: function 'int ilogb(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1083): note: see previous definition of 'ilogb'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(188): error C2084: function 'float ldexp(float,int) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1085): note: see previous definition of 'ldexp'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(193): error C2084: function 'float lgamma(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1087): note: see previous definition of 'lgamma'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(198): error C2084: function '__int64 llrint(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1089): note: see previous definition of 'llrint'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(203): error C2084: function '__int64 llround(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1091): note: see previous definition of 'llround'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(208): error C2084: function 'float log(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1093): note: see previous definition of 'log'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(213): error C2084: function 'float log10(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1095): note: see previous definition of 'log10'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(218): error C2084: function 'float log1p(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1097): note: see previous definition of 'log1p'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(223): error C2084: function 'float log2(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1099): note: see previous definition of 'log2'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(228): error C2084: function 'float logb(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1101): note: see previous definition of 'logb'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(233): error C2084: function 'long lrint(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1103): note: see previous definition of 'lrint'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(238): error C2084: function 'long lround(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1105): note: see previous definition of 'lround'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(243): error C2084: function 'float modf(float,float *) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1107): note: see previous definition of 'modf'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(248): error C2084: function 'float nearbyint(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1109): note: see previous definition of 'nearbyint'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(253): error C2084: function 'float nextafter(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1111): note: see previous definition of 'nextafter'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(259): error C2084: function 'float nexttoward(float,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1113): note: see previous definition of 'nexttoward'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(265): error C2084: function 'float pow(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1115): note: see previous definition of 'pow'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(270): error C2084: function 'float pow(float,int) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1117): note: see previous definition of 'pow'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(275): error C2084: function 'float remainder(float,float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1119): note: see previous definition of 'remainder'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(281): error C2084: function 'float remquo(float,float,int *) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1121): note: see previous definition of 'remquo'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(286): error C2084: function 'float rint(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1123): note: see previous definition of 'rint'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(291): error C2084: function 'float round(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1125): note: see previous definition of 'round'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(296): error C2084: function 'float scalbln(float,long) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1127): note: see previous definition of 'scalbln'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(301): error C2084: function 'float scalbn(float,int) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1129): note: see previous definition of 'scalbn'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(306): error C2084: function 'float sin(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1131): note: see previous definition of 'sin'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(311): error C2084: function 'float sinh(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1133): note: see previous definition of 'sinh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(316): error C2084: function 'float sqrt(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1135): note: see previous definition of 'sqrt'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(321): error C2084: function 'float tan(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1137): note: see previous definition of 'tan'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(326): error C2084: function 'float tanh(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1139): note: see previous definition of 'tanh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(331): error C2084: function 'float tgamma(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1141): note: see previous definition of 'tgamma'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(336): error C2084: function 'float trunc(float) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1143): note: see previous definition of 'trunc'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(341): error C2084: function 'long double abs(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1145): note: see previous definition of 'abs'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(346): error C2084: function 'long double acos(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1147): note: see previous definition of 'acos'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(351): error C2084: function 'long double acosh(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1149): note: see previous definition of 'acosh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(356): error C2084: function 'long double asin(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1151): note: see previous definition of 'asin'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(361): error C2084: function 'long double asinh(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1153): note: see previous definition of 'asinh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(366): error C2084: function 'long double atan(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1155): note: see previous definition of 'atan'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(371): error C2084: function 'long double atanh(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1157): note: see previous definition of 'atanh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(377): error C2084: function 'long double atan2(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1159): note: see previous definition of 'atan2'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(382): error C2084: function 'long double cbrt(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1161): note: see previous definition of 'cbrt'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(387): error C2084: function 'long double ceil(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1163): note: see previous definition of 'ceil'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(393): error C2084: function 'long double copysign(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1165): note: see previous definition of 'copysign'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(398): error C2084: function 'long double cos(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1167): note: see previous definition of 'cos'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(403): error C2084: function 'long double cosh(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1169): note: see previous definition of 'cosh'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(408): error C2084: function 'long double erf(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1171): note: see previous definition of 'erf'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(413): error C2084: function 'long double erfc(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1173): note: see previous definition of 'erfc'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(418): error C2084: function 'long double exp(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1175): note: see previous definition of 'exp'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(423): error C2084: function 'long double exp2(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1177): note: see previous definition of 'exp2'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(428): error C2084: function 'long double expm1(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1179): note: see previous definition of 'expm1'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(433): error C2084: function 'long double fabs(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1181): note: see previous definition of 'fabs'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(439): error C2084: function 'long double fdim(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1183): note: see previous definition of 'fdim'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(444): error C2084: function 'long double floor(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1185): note: see previous definition of 'floor'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(450): error C2084: function 'long double fma(long double,long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1187): note: see previous definition of 'fma'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(456): error C2084: function 'long double fmax(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1189): note: see previous definition of 'fmax'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(462): error C2084: function 'long double fmin(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1191): note: see previous definition of 'fmin'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(468): error C2084: function 'long double fmod(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1193): note: see previous definition of 'fmod'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(474): error C2084: function 'long double frexp(long double,int *) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1195): note: see previous definition of 'frexp'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(480): error C2084: function 'long double hypot(long double,long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1197): note: see previous definition of 'hypot'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(485): error C2084: function 'int ilogb(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1199): note: see previous definition of 'ilogb'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(491): error C2084: function 'long double ldexp(long double,int) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1201): note: see previous definition of 'ldexp'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(496): error C2084: function 'long double lgamma(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1203): note: see previous definition of 'lgamma'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(501): error C2084: function '__int64 llrint(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1205): note: see previous definition of 'llrint'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(506): error C2084: function '__int64 llround(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1207): note: see previous definition of 'llround'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(511): error C2084: function 'long double log(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1209): note: see previous definition of 'log'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(516): error C2084: function 'long double log10(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1211): note: see previous definition of 'log10'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(521): error C2084: function 'long double log1p(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1213): note: see previous definition of 'log1p'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(526): error C2084: function 'long double log2(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1215): note: see previous definition of 'log2'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(531): error C2084: function 'long double logb(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1217): note: see previous definition of 'logb'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(536): error C2084: function 'long lrint(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1219): note: see previous definition of 'lrint'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(541): error C2084: function 'long lround(long double) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1221): note: see previous definition of 'lround'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(547): error C2084: function 'long double modf(long double,long double *) throw()' already has a body
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(1223): note: see previous definition of 'modf'
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(547): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I would appreciate if anyone had suggestions for how to resolve this problem.
Thanks for any help.

Your toolchain is completely broken. I suggest removing then re-installing Visual Studio.

Related

Why does my istream_iterator not work?

Here is the code that I wrote. I am using Visual studio and learning how to use the standard template library. The ostream_iterator doesn't work either when I try to print from a source. It gives out a huge list of errors, those which I can't possibly understand.
This here is the complete code I am trying to run in Visual Studio. Can there be a problem in the software settings?
#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <functional>
using namespace std;
//stream_iterator
int main() {
vector<string> source = { "31", "3113" };
copy(istream_iterator<string>(cin), istream_iterator<string>(),back_inserter(source)); //can't understand why this won't work
return 0;
}
These below are the error messages.
1>------ Build started: Project: StreamIters, Configuration: Debug Win32 ------
1> Source.cpp
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\iterator(256): error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(485): could be 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(std::basic_streambuf<char,std::char_traits<char>> *)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(466): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(void *&)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(448): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(long double &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(430): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(double &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(411): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(float &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(392): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(unsigned __int64 &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(373): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(__int64 &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(353): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(unsigned long &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(335): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(long &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(317): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(unsigned int &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(291): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(int &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(272): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(unsigned short &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(237): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(short &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(218): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(std::_Bool &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(211): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(std::ios_base &(__cdecl *)(std::ios_base &))'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(204): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(std::basic_ios<char,std::char_traits<char>> &(__cdecl *)(std::basic_ios<char,std::char_traits<char>> &))'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(198): or 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::operator >>(std::basic_istream<char,std::char_traits<char>> &(__cdecl *)(std::basic_istream<char,std::char_traits<char>> &))'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(1103): or 'std::basic_istream<char,std::char_traits<char>> &std::operator >><char,std::char_traits<char>,_Ty>(std::basic_istream<char,std::char_traits<char>> &&,_Ty &)'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(1093): or 'std::basic_istream<char,std::char_traits<char>> &std::operator >><std::char_traits<char>>(std::basic_istream<char,std::char_traits<char>> &,unsigned char &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(1086): or 'std::basic_istream<char,std::char_traits<char>> &std::operator >><std::char_traits<char>>(std::basic_istream<char,std::char_traits<char>> &,unsigned char *)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(1079): or 'std::basic_istream<char,std::char_traits<char>> &std::operator >><std::char_traits<char>>(std::basic_istream<char,std::char_traits<char>> &,signed char &)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\istream(1072): or 'std::basic_istream<char,std::char_traits<char>> &std::operator >><std::char_traits<char>>(std::basic_istream<char,std::char_traits<char>> &,signed char *)'
1> while trying to match the argument list '(std::basic_istream<char,std::char_traits<char>>, std::string)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\iterator(255) : while compiling class template member function 'void std::istream_iterator<std::string,char,std::char_traits<char>,ptrdiff_t>::_Getval(void)'
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\iterator(222) : see reference to function template instantiation 'void std::istream_iterator<std::string,char,std::char_traits<char>,ptrdiff_t>::_Getval(void)' being compiled
1> c:\users\mahe\documents\visual studio 2013\projects\streamiters\streamiters\source.cpp(19) : see reference to class template instantiation 'std::istream_iterator<std::string,char,std::char_traits<char>,ptrdiff_t>' being compiled
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The code lacks inclusion of the header <string>. While the interfaces used do require that at least a declaration of std::string is available, there is no requirement that the headers you included provide a definition of std::string and/or functions operating on them. I don't have MSVC++ installed but it seems the headers you included provide a definition of std::string but no declaration of the input or output operators.
As a rule of thumb you should never rely on indirect inclusion. Instead, you should always include all relevant headers explicitly: although the declarations may currently be available, headers may change to not include other headers.

error C2084: function 'float cbrt(float) throw()' already has a body

I successfully complied this project under the platform of visual studio 2010,but in vs 2013 has occured these errors:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1045) : see previous definition of 'cbrt'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(657) : error C2084: function 'long double cbrt(long double) throw()' already has a body
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1161) : see previous definition of 'cbrt'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(664) : error C2084: function 'float round(float) throw()' already has a body
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1125) : see previous definition of 'round'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(672) : error C2084: function 'long double round(long double) throw()' already has a body
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1241) : see previous definition of 'round'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(679) : error C2084: function 'float trunc(float) throw()' already has a body
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1143) : see previous definition of 'trunc'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(687) : error C2084: function 'long double trunc(long double) throw()' already has a body
I want to know why there is such a difference,and how to solve it ?
why there is such a difference about VS2010 and VS2013 ? Because VS2010 doesn't have define of "cbrt",but Vs2013 have.So you can use _MSC_VER , or directly comment repeat function body in Vec.h.

How to use std::for_each with a member function, where the provided data structure gives the parameter and not object

I cannot use C++11.
Normally when using std::for_each with a member function, the provided data structure gives the object on which the bound member function is called. However, I would like to know if it's possible to provide my own object which is constant throughout the loop, and use the data structure for the parameters to this member function.
Here is an example of what I want to do.
std::string GenerateKey(const std::vector<std::string>& parameters)
{
std::string key;
key.reserve(std::accumulate(parameters.begin(), parameters.end(), 0, std::mem_fun_ref(&std::string::length)));
std::for_each(parameters.begin(), parameters.end(), std::bind1st(std::mem_fun_ref(&std::string::append), key));
return key;
}
The intention is that for each string in parameters, append will be called on key, and be passed a string from parameters.
Why does this std::for_each not work, and how or can it be made to work?
I know there are alternative ways to concatenate strings. I want to understand C++ functional programming better.
Thanks.
Here are error messages from VS2013, which I doubt will help..
generator.cpp(28): error C2784: 'std::const_mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::const_mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for '_Result'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::const_mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for '_Ty'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::const_mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for '_Arg'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(910) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2784: 'std::const_mem_fun_ref_t<_Result,_Ty> std::mem_fun_ref(_Result (__thiscall _Ty::* )(void) const)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::const_mem_fun_ref_t<_Result,_Ty> std::mem_fun_ref(_Result (__thiscall _Ty::* )(void) const)' : could not deduce template argument for '_Result'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::const_mem_fun_ref_t<_Result,_Ty> std::mem_fun_ref(_Result (__thiscall _Ty::* )(void) const)' : could not deduce template argument for '_Ty'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(901) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2784: 'std::mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg))' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2914: 'std::mem_fun_ref' : cannot deduce template argument as function argument is ambiguous
generator.cpp(28): error C2783: 'std::mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg))' : could not deduce template argument for '_Result'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg))' : could not deduce template argument for '_Ty'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::mem_fun1_ref_t<_Result,_Ty,_Arg> std::mem_fun_ref(_Result (__thiscall _Ty::* )(_Arg))' : could not deduce template argument for '_Arg'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(893) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2784: 'std::mem_fun_ref_t<_Result,_Ty> std::mem_fun_ref(_Result (__thiscall _Ty::* )(void))' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::mem_fun_ref_t<_Result,_Ty> std::mem_fun_ref(_Result (__thiscall _Ty::* )(void))' : could not deduce template argument for '_Result'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2783: 'std::mem_fun_ref_t<_Result,_Ty> std::mem_fun_ref(_Result (__thiscall _Ty::* )(void))' : could not deduce template argument for '_Ty'
c:\program files\microsoft visual studio 12.0\vc\include\xfunctional(884) : see declaration of 'std::mem_fun_ref'
generator.cpp(28): error C2780: '_Fn1 std::for_each(_InIt,_InIt,_Fn1)' : expects 3 arguments - 2 provided
c:\program files\microsoft visual studio 12.0\vc\include\algorithm(29) : see declaration of 'std::for_each'
std::string::append is overloaded and the compiler is unable to know which function you meant.
So, std::string::append actually refers to a set of functions.
This error there because there are some of overloaded versions function std::string::append, you can use cast to tell compiler what exacly function need to use:
std::for_each(parameters.begin(), parameters.end(), std::bind1st(std::mem_fun_ref(static_cast<std::string& (std::string::*)(const std::string&)>(&std::string::append)), key));
Edit: but in this case it won't be worked, because bind1st will not work with functions, that takes references as parameter.
See: Using bind1st for a method that takes argument by reference

'identifier' : redefinition errors ( error C2011 & error C2370)

Every time I try to compile my code, I get a huge amount of errors. It's not a problem with my code, cause it was working just fine on another computer. I tried re-installing and fixing, but that didn't help. Here's the whole error message:
1>------ Build started: Project: Raptor Triangle 2, Configuration: Debug Win32 ------
1> Raptor Triangle 2.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57): error C2011: 'vc_attributes::YesNoMaybe' : 'enum' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57) : see declaration of 'vc_attributes::YesNoMaybe'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67): error C2011: 'vc_attributes::AccessType' : 'enum' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67) : see declaration of 'vc_attributes::AccessType'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(81): error C2011: 'vc_attributes::Pre' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(81) : see declaration of 'vc_attributes::Pre'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(78): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(112): error C2011: 'vc_attributes::Post' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(112) : see declaration of 'vc_attributes::Post'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(109): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(143): error C2011: 'vc_attributes::FormatString' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(143) : see declaration of 'vc_attributes::FormatString'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(155): error C2011: 'vc_attributes::InvalidCheck' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(155) : see declaration of 'vc_attributes::InvalidCheck'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(152): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(165): error C2011: 'vc_attributes::Success' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(165) : see declaration of 'vc_attributes::Success'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(176): error C2011: 'vc_attributes::PreBound' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(176) : see declaration of 'vc_attributes::PreBound'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(173): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(186): error C2011: 'vc_attributes::PostBound' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(186) : see declaration of 'vc_attributes::PostBound'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(183): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(196): error C2011: 'vc_attributes::PreRange' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(196) : see declaration of 'vc_attributes::PreRange'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(193): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(208): error C2011: 'vc_attributes::PostRange' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(208) : see declaration of 'vc_attributes::PostRange'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(205): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(245): error C2370: 'SA_Yes' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(245) : see declaration of 'SA_Yes'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(246): error C2370: 'SA_No' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(246) : see declaration of 'SA_No'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(247): error C2370: 'SA_Maybe' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(247) : see declaration of 'SA_Maybe'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(250): error C2370: 'SA_NoAccess' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(250) : see declaration of 'SA_NoAccess'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(251): error C2370: 'SA_Read' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(251) : see declaration of 'SA_Read'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(252): error C2370: 'SA_Write' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(252) : see declaration of 'SA_Write'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(253): error C2370: 'SA_ReadWrite' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(253) : see declaration of 'SA_ReadWrite'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Help? Haha. I don't get it. I looked up the error codes but couldn't figure out what to do.
Also, I can post the code if need be, but it's pretty long.
EDIT: I solved it, but I don't get why. I got rid of my line to include windows.h, which I needed for Sleep(). I still don't get why that matters though.
Another cause of C2370 is when multiple copies of a header file, containing a constant, exist.
Different projects then access different copies of the same header file, breaking the '#pragma once' and causing 'C2370 redefinition; different storage class'.
A common reason for file duplication to exist is when developers make a local copy of dependent library headers while a globally accessible still SDK exists.
You need to form your header file as following:
#ifndef HEADERFILENAME_DEF
#define HEADERFILENAME_DEF
/* all declarations here */
#endif
This will prevent double inclusion of a header file.
The object files must be out of date. Try a clean build - i.e. Clean/Build. windows.h should have nothing to do with it.
I had the same problem with VS2008. I resolved with:
change Yes (/Wp64) --> No

Why won't this code compile and run in Visual Studio 2010?

I am trying to get Visual Studio 2010 set up to do plain old ANSI compilation, without Microsoft extensions of any kind.
I started with an empty project template, since there doesn't seem to be a plain ANSI project template in 2010 anymore.
Then I set
Properties -> Configuration Properties -> C/C++ -> Language -> Disable Extensions = Yes (/Za)
Here is my code:
#include <iostream>
int main( int argc, const char* argv[] )
{
std::cout << "Hello World!";
return 0;
}
Here are the errors:
1>------ Build started: Project: ansi_test, Configuration: Release Win32 ------
1>Build started 4/27/2011 4:20:00 PM.
1>InitializeBuildStatus:
1> Touching "Release\ansi_test.unsuccessfulbuild".
1>ClCompile:
1> Main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(636): error C3861: 'width': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(636): error C3861: 'width': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(639): error C3861: 'flags': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(643): error C2227: left of '->sputc' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(643): error C2780: 'void std::fill(_FwdIt,_FwdIt,const _Ty &)' : expects 3 arguments - 0 provided
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2712) : see declaration of 'std::fill'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(643): error C3861: 'rdbuf': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(648): error C2227: left of '->sputc' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(648): error C3861: 'rdbuf': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(654): error C2227: left of '->sputc' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(654): error C2780: 'void std::fill(_FwdIt,_FwdIt,const _Ty &)' : expects 3 arguments - 0 provided
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2712) : see declaration of 'std::fill'
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(654): error C3861: 'rdbuf': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ostream(659): error C3861: 'width': identifier not found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.63
How do I get this, the most basic of C++ code to compile cleanly?
The error disappears if you define wchar_t as native type.
If I copy your code into a file, test.cpp and then issue the command
cl /Za /EHsc test.cpp
then it compiles cleanly without any warnings or errors on my install of visual c++ express 2010. /EHsc is necessary in order to handle exceptions properly and I don't really understand why it isn't the default.
Is this different from what you are doing?