山楂 visual studio 2015
glog on visual studio 2015
我正在尝试使用 Visual Studio 2015 在 windows 上构建 Google glog 库。添加 #include 以解决 [=25= 上的 std::min 问题后],我在下面遇到了 2 个主要错误(1 重复了几次)。
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\include.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
似乎是编译器生成的移动函数有问题,但明确删除它也不起作用。
LogMessage(const LogMessage&&) = 删除;
有什么想法吗?
干杯,迈克
生成的函数不是LogMessage(const LogMessage&&) = delete;
但它是:
LogStream::LogStream(google::LogMessage::LogStream &&).
在内部,它将尝试调用 LogStream 的复制构造函数,因此调用标记为已删除的 ostream。
解决方案:
在 LogStream 中声明 class:
LogStream(const LogStream&) = delete;
LogStream& operator=(const LogStream&) = delete;;
干杯
我正在尝试使用 Visual Studio 2015 在 windows 上构建 Google glog 库。添加 #include 以解决 [=25= 上的 std::min 问题后],我在下面遇到了 2 个主要错误(1 重复了几次)。
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\include.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
似乎是编译器生成的移动函数有问题,但明确删除它也不起作用。
LogMessage(const LogMessage&&) = 删除;
有什么想法吗?
干杯,迈克
生成的函数不是LogMessage(const LogMessage&&) = delete;
但它是:
LogStream::LogStream(google::LogMessage::LogStream &&).
在内部,它将尝试调用 LogStream 的复制构造函数,因此调用标记为已删除的 ostream。
解决方案:
在 LogStream 中声明 class:
LogStream(const LogStream&) = delete;
LogStream& operator=(const LogStream&) = delete;;
干杯