Getting Linker Errors When using protobuf static library in my mfc application(windows)

1,695 views
Skip to first unread message

k.mur...@gmail.com

unread,
Jun 6, 2009, 9:58:17 AM6/6/09
to Protocol Buffers
Hi all,
I have followed the steps suggested in readme.txt in vsprojects folder
of protobuf. I copied the required the .lib files to the current
directory of my mfc application and set the path correctly to the
location of the libraries. I included the header files generated by
extract_headers.exe and I tried using those apis and classes provided
by the library and wrote a simple function. When i tried building the
solution i got lot of errors as

1>------ Build started: Project: NEW_PTOTOBUF, Configuration: Debug
Win32 ------
1>Linking...
1>libprotobuf.lib(reflection_ops.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(extension_set.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(text_format.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(common.obj) : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ) referenced in function "void (__cdecl**
__cdecl std::_Copy_backward_opt<void (__cdecl**)(void),void (__cdecl**)
(void),struct std::random_access_iterator_tag>(void (__cdecl**)
(void),void (__cdecl**)(void),void (__cdecl**)(void),struct
std::random_access_iterator_tag,struct
std::_Scalar_ptr_iterator_tag,struct std::_Range_checked_iterator_tag))
(void)" (??
$_Copy_backward_opt@PAP6AXXZPAP6AXXZUrandom_access_iterator_tag@std@@@std@@YAPAP6AXXZPAP6AXXZ00Urandom_access_iterator_tag@0@U_Scalar_ptr_iterator_tag@0@U_Range_checked_iterator_tag@0@@Z)
1>libprotobuf.lib(message.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(unknown_field_set.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(wire_format.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(importer.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(parser.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(descriptor_database.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(descriptor.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::~_Container_base(void)" (__imp_??
1_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(text_format.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(unknown_field_set.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(wire_format.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ) referenced in function
"public: static int __cdecl
google::protobuf::internal::WireFormat::ByteSize(class
google::protobuf::Message const &)" (?
ByteSize@WireFormat@internal@protobuf@google@@SAHABVMessage@34@@Z)
1>libprotobuf.lib(reflection_ops.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(extension_set.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(strutil.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(common.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(message.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(generated_message_reflection.obj) : error LNK2001:
unresolved external symbol "__declspec(dllimport) public: void
__thiscall std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(importer.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(parser.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(descriptor_database.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(descriptor.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Orphan_all(void)const " (__imp_?
_Orphan_all@_Container_base@std@@QBEXXZ)
1>libprotobuf.lib(reflection_ops.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(extension_set.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(text_format.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(common.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(message.obj) : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ) referenced in function "public:
__thiscall google::protobuf::hash_map<class
google::protobuf::Descriptor const *,class google::protobuf::Message
const *,struct google::protobuf::hash<class
google::protobuf::Descriptor const *>,int>::~hash_map<class
google::protobuf::Descriptor const *,class google::protobuf::Message
const *,struct google::protobuf::hash<class
google::protobuf::Descriptor const *>,int>(void)" (??1?
$hash_map@PBVDescriptor@protobuf@google@@PBVMessage@23@U?
$hash@PBVDescriptor@protobuf@google@@@23@H@protobuf@google@@QAE@XZ)
1>libprotobuf.lib(unknown_field_set.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(wire_format.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(importer.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(parser.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(descriptor_database.obj) : error LNK2001: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(descriptor.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::_Container_base::_Container_base(void)" (__imp_??
0_Container_base@std@@QAE@XZ)
1>libprotobuf.lib(extension_set.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: void __thiscall
std::_Container_base::_Swap_all(class std::_Container_base &)const
" (__imp_?_Swap_all@_Container_base@std@@QBEXAAV12@@Z) referenced in
function "public: void __thiscall std::_Tree<class
std::_Tmap_traits<int,struct
google::protobuf::internal::ExtensionSet::Extension,struct
std::less<int>,class std::allocator<struct std::pair<int const ,struct
google::protobuf::internal::ExtensionSet::Extension> >,0> >::swap
(class std::_Tree<class std::_Tmap_traits<int,struct
google::protobuf::internal::ExtensionSet::Extension,struct
std::less<int>,class std::allocator<struct std::pair<int const ,struct
google::protobuf::internal::ExtensionSet::Extension> >,0> > &)" (?
swap@?$_Tree@V?
$_Tmap_traits@HUExtension@ExtensionSet@internal@protobuf@google@@U?
$less@H@std@@V?$allocator@U?$pair@$
$CBHUExtension@ExtensionSet@internal@protobuf@google@@@std@@@7@
$0A@@std@@@std@@QAEXAAV12@@Z)
1>C:\Documents and Settings\murahari_kathula\My Documents\Visual
Studio 2008\Projects\NEW_PTOTOBUF\Debug\NEW_PTOTOBUF.exe : fatal error
LNK1120: 4 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings
\murahari_kathula\My Documents\Visual Studio 2008\Projects\NEW_PTOTOBUF
\NEW_PTOTOBUF\Debug\BuildLog.htm"
1>NEW_PTOTOBUF - 37 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

Can anyone tell me what may be wrong with my procedure..

Kenton Varda

unread,
Jun 8, 2009, 12:16:33 PM6/8/09
to k.mur...@gmail.com, Protocol Buffers
It looks like it's having trouble finding stuff from the C++ standard runtime.  Did you make sure to link against the same version of the runtime?

Murahari

unread,
Jun 10, 2009, 7:01:26 AM6/10/09
to Protocol Buffers
Hi Kenton,
Thank you for your reply.. I did a mistake in pointing the include
directories and include libraries for libprotobuf.lib in project
settings. After creating libs directory and putting the .lib file in
that and creating the include directory and putting the google/..
include files in that directory, problem got solved..

~Murahari
> ...
>
> read more »- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages