Mike
Mike

Reputation: 4259

glog on visual studio 2015

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

Upvotes: 0

Views: 1964

Answers (1)

Iulian Rotaru
Iulian Rotaru

Reputation: 72

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

Upvotes: 1

Related Questions