glog on visual studio 2015 - c++

I am trying to build Google glog library on windows using Visual Studio 2015. After adding #include to get around the std::min problem on Windows, I get to 2 main errors (1 repeats a few times) below.
1>c:\glog\glog-0.3.3\src\windows\port.h(117): warning C4005: 'va_copy': macro redefinition
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdarg.h(20): note: see previous definition of 'va_copy'
1>c:\glog\glog-0.3.3\src\windows\port.cc(58): error C2084: function 'int snprintf(char *const ,const size_t,const char *const ,...)' already has a body
1> c:\program files (x86)\windows kits\10\include\10.0.10150.0\ucrt\stdio.h(1932): note: see previous definition of 'snprintf'
1> vlog_is_on.cc
1>c:\glog\glog-0.3.3\src\windows\port.h(117): warning C4005: 'va_copy': macro redefinition
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdarg.h(20): note: see previous definition of 'va_copy'
1>c:\glog\glog-0.3.3\src\windows\glog\logging.h(1266): error C2280: 'std::basic_ios<char,std::char_traits<char>>::basic_ios(const std::basic_ios<char,std::char_traits<char>> &)': attempting to reference a deleted function
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\ios(189): note: see declaration of 'std::basic_ios<char,std::char_traits<char>>::basic_ios'
1> c:\glog\glog-0.3.3\src\windows\glog\logging.h(1266): note: This diagnostic occurred in the compiler generated function 'google::LogMessage::LogStream::LogStream(google::LogMessage::LogStream &&)'
1> utilities.cc
Seems to be an issue with the compiler generated move function, but explicitly deleting it does not work either.
LogMessage(const LogMessage&&) = delete;
Any ideas?
Cheers, Mike

The generated function is not LogMessage(const LogMessage&&) = delete;
but it is:
LogStream::LogStream(google::LogMessage::LogStream &&).
Internaly it will try to call the copy constructor of LogStream and hence the ostream which is marked as deleted.
Solution:
declare inside LogStream class:
LogStream(const LogStream&) = delete;
LogStream& operator=(const LogStream&) = delete;;
Cheers

Related

Using two different math libraries in the same project confuses Visual C++

My project needs to use both Micorsoft Visual C++ math.h and Intel MKL math.h.
Building with verbose details, I get:
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\cmath
1> Note: including file: E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\crtdefs.h
1> E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h(1577): warning C4005: 'HUGE_VALF' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h(104) : see previous definition of 'HUGE_VALF'
1> E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h(1579): warning C4005: 'HUGE_VALL' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h(105) : see previous definition of 'HUGE_VALL'
1> E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h(1581): warning C4005: 'HUGE_VAL' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h(96) : see previous definition of 'HUGE_VAL'
The "'HUGE_VALF' : macro redefinition" message is the one that made me be suspicious.
At first I just disabled that warning, but considering that this option would only mask a potential problem, I am looking for an alternative solution.
From lines 1 and 2, you can see that Visual Studio's cmath does not include Visual Studio's math.h, as it should, but MKL's file with the same name.
How can I set my CMakeLists.txt file so that the compiler can pick the right include files?
Just wrap one library.
For example, create header file:
#pragma once
namespace imath {
double sin(double a);
}
And in cpp
#include "Wrapper.h"
#include <intel/math.h>
namespace imath {
double sin(double a) {
return ::sin(a);
}
}
Do this for every symbol you need to use in common source.
And do not include C version of math.h you are using C++ so #include <cmath>.

Iostream in Visual Studio 2015

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.

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.

Why does Visual Studio 2010 throw this error with Boost 1.42.0?

I'm trying to recompile application, that compiles fine with warning level 4 in visual studio 2005 and visual studio 2008.
Since the errors (look below) are coming from std:tr1, I'm thinking there's some conflict, but not sure how to fix. My first thought was to remove all references to boost, such as but then I get an error that it can't find format method.
So here's one of the errors: (not sure what it means)
Any ideas, suggestions, solutions?
Thanks!
EDIT: Right at the beginning I see a message: Unknown compiler version - please run the configure tests and report the results
EDIT2: Piece of code that I think causes this error: (changed to protect the innocent)
EDIT3: I updated the error message, i.e added more..however I get many more error messages such as this one..so there's a bigger problem/issue.
!m_someMap.insert( std::make_pair( "somestring", SomeClass::isTrue ) ).second
....
.....
inline bool isTrue ( const IDog & dog ) { return s.IsDogTrue(); }
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(197): error C2752: 'std::tr1::_Remove_reference<_Ty>' : more than one partial specialization matches the template argument list
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtr1common(356): could be 'std::tr1::_Remove_reference<_Ty&&>'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtr1common(350): or 'std::tr1::_Remove_reference<_Ty&>'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(962) : see reference to class template instantiation 'std::tr1::remove_reference<_Ty>' being compiled
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(26) : see reference to class template instantiation 'std::tr1::decay<_Ty>' being compiled
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1> C:\(PATH)\...(915) : see reference to class template instantiation 'std::tr1::_Unrefwrap<_Type>' being compiled
1> with
1> [
1> _Type=bool (__cdecl &)(const IDog &)
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(965): error C2528: 'abstract declarator' : pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(349): error C2528: 'type' : pointer to reference is illegal
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(967) : see reference to class template instantiation 'std::tr1::add_pointer<_Ty>' being compiled
1> with
1> [
1> _Ty=bool (__cdecl &)(const IDog &)
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\type_traits(197): error C2752: 'std::tr1::_Remove_reference<_Ty>' : more than one partial specialization matches the template argument list
1> with
1> [
1> _Ty=bool (__cdecl &)(const char *,int,const char *,std::string &)
1> ]
the problem is with visual studio 2010, or I should say that with additional templates that were added to visual studio 2010 tr1, so, std::make_pair, doesn't always work. changed to pair<> and all errors magically went away.
so, if you have template problems in VC2010 and using std:make_pair, change it to pair<> and specify template parameters.
It sounds like Visual Studio might be doing something you don't know. I think you can use the Microsoft compiler with the code::blocks IDE. You can try each compiler (VS 2005/2008/2010). Also, try a diff from your source code repository to be sure Microsoft didn't "prettify" your code.
Note: You don't have to use Code::Blocks after you figure out the problem. It just might be a good tool for this particular issue.

VS2005 C++ compiler problem including <comdef.h> in MFC application

I am having some trouble converting an old project from VS6 to VS2005. At one place in the code it uses the type variant_t so it includes comdef.h for this purpose. comdef.h then includes comutil.h which generates these errors for me:
c:\program files\microsoft visual studio 8\vc\include\comutil.h(978) : error C2535: '_variant_t::_variant_t(int) throw()' : member function already defined or declared
c:\program files\microsoft visual studio 8\vc\include\comutil.h(970) : see declaration of '_variant_t::_variant_t'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1007) : error C2535: '_variant_t::operator int(void) const' : member function already defined or declared
c:\program files\microsoft visual studio 8\vc\include\comutil.h(998) : see declaration of '_variant_t::operator int'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1037) : error C2535: '_variant_t &_variant_t::operator =(int)' : member function already defined or declared
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1029) : see declaration of '_variant_t::operator ='
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1331) : error C2084: function '_variant_t::_variant_t(int) throw()' already has a body
c:\program files\microsoft visual studio 8\vc\include\comutil.h(970) : see previous definition of '{ctor}'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1588) : error C2084: function '_variant_t::operator int(void) const' already has a body
c:\program files\microsoft visual studio 8\vc\include\comutil.h(998) : see previous definition of '.H'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(2006) : error C2084: function '_variant_t &_variant_t::operator =(int)' already has a body
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1029) : see previous definition of '='
There is probably some configuration that is incorrect, some define missing or some include file I should have included but I can't seem to find the problem. Any pointers in the right direction is much appreciated
This looks like one of two things, an include order problem or as you stated something not getting defined but I am leaning towards the first one. You might want to check msdn and make sure there are no restrictions on when comutil.h can be included (I know this is an issue if you include winsock2.h before windows.h). There is also an option under C/C++ > Advanced to Show Includes (/showIncludes option from the command-line) which is generally helpful when trying to track issues like this down.
Does your own code do something like this:
#define long int