"needs to have dll-interface" error when using protobuf with Visual C++ 2017

1,829 views
Skip to first unread message

John Lilley

unread,
Jul 1, 2018, 4:37:30 PM7/1/18
to Protocol Buffers
I have installed protobuf 3.5.1 using the "vcpkg" method on Windows.  I can generate code, but when I try to compile I get many errors like:

1>f:\vcpkg\installed\x64-windows\include\google\protobuf\stubs\logging.h(100): warning C4251: 'google::protobuf::internal::LogMessage::message_': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::LogMessage'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\xstring(4347): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'

I can use std::string elsewhere in my code without this issue, so I suspect that I need to set some preprocessor flag(s) in my project? 

The Readme says "When compiling your project, make sure to #define PROTOBUF_USE_DLLS".  However, doing so has no effect other than to report a duplicate macro definition warning.
Thanks
john



John Lilley

unread,
Jul 2, 2018, 9:19:38 AM7/2/18
to prot...@googlegroups.com
Never mind, I RT'd the FM :-)
john


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Jim Gallogly

unread,
Aug 30, 2018, 3:49:04 PM8/30/18
to Protocol Buffers
What in the manual did you read. Searching for the same issue.

Jim Gallogly

unread,
Aug 31, 2018, 8:03:08 AM8/31/18
to Protocol Buffers
I think you read that its just a warning and everything will be ok and you can ignore it
Reply all
Reply to author
Forward
0 new messages