[xsd-users] Shared library and exported symbols problem

Klaim - Joël Lamotte mjklaim at gmail.com
Mon Jul 4 16:16:50 EDT 2011


Hi,

I'm still stuck with this problem. I'm considering switching to a static
library temporarly to continue other works as I still need aoslcpp and
aosdesigner to work together in a way or another.
But before going to extreme solutions, I'm trying to understand where the
problem comes from exactly.

It is strange that my test executable isn't affected by the same problem. I
tried comparing .lib import from the two projects but they seem similar
(both import aoslcpp.lib and xerces lib).

I modified the test to reproduce the same problem, with "success". I tweaked
it to corner the specific case, and it seems that what is really needed is
to include the generated code in the headers of my projects instead of just
including them in the cpp. For example, assuming I have an aosl::Sequence
class generated with this configuration :
http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/script/generate_cpp.cfg

In main.cpp :

#include <iostream>
 #include "test.h"


 int main()
{
	std::cout << "Hello, world!";

	Test test("a_test");
	
	
	
	return 0;
}


Then I tried to define Test in two different ways. First the one that gives
the same link error :

#pragma  once
 #include <string>#include <memory>
 namespace aosl
{
	class Sequence;
}
 class Test
{public:

	Test( const std::string& name );

	~Test();

	const std::string& name()  const { return m_name; }
 private:

	std::string m_name;
	std::unique_ptr<aosl::Sequence> m_sequence;

};


test.cpp :

#include "test.h"

 #include "aoslcpp/aosl/sequence.hpp"


Test::Test( const std::string& name )
	: m_name( name )
	, m_sequence( new aosl::Sequence )
{

}

Test::~Test()
{

}



Now, the modified version that does compile and link without any problem :

#pragma  once
 #include <string>#include <memory>
 #include "aoslcpp/aosl/sequence.hpp" // added this
 class Test
{public:

	Test( const std::string& name );

	~Test();

	const std::string& name()  const { return m_name; }
 private:

	std::string m_name;
	std::unique_ptr<aosl::Sequence> m_sequence;

};



Once I found that it might be a solution, I tried to apply the same change
in this file of aosdesigner that is similar to the Test class :
http://code.google.com/p/art-of-sequence/source/browse/tools/aosdesigner/core/Sequence.hpp

But that generates link errors with boost filesystem :

1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at ABV01@@Z)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??0?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??1?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::operator=(char const *)" (??4?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at PBD@Z) already defined
in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::operator+=(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(??Y?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEAAV01 at ABV01@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::operator+=(char const *)" (??Y?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at PBD@Z) already defined
in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: char const * __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::c_str(void)const "
(?c_str@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEPBDXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: bool __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::empty(void)const "
(?empty@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBE_NXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::append(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)" (?append@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV12 at ABV12@@Z)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::append(char const *)" (?append@?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV12 at PBD@Z) already defined
in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: unsigned int __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::size(void)const "
(?size@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Tidy(bool,unsigned
int)" (?_Tidy@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEX_NI at Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: __thiscall std::_String_val<char,class
std::allocator<char> >::_String_val<char,class std::allocator<char> >(class
std::allocator<char>)" (??0?$_String_val at DV?$allocator at D@std@@@std@@QAE at V
?$allocator at D@1@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: __thiscall std::_String_val<char,class
std::allocator<char> >::~_String_val<char,class std::allocator<char>
>(void)" (??1?$_String_val at DV?$allocator at D@std@@@std@@QAE at XZ) already
defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV12 at II@Z)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: char * __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Myptr(void)" (?_Myptr@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEPADXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: unsigned int __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::max_size(void)const "
(?max_size@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::_String_iterator<char,struct
std::char_traits<char>,class std::allocator<char> > __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::end(void)" (?end@?$basic_string at DU?$char_traits at D
@std@@V?$allocator at D@2@@std@@QAE?AV?$_String_iterator at DU?$char_traits at D@std@
@V?$allocator at D@2@@2 at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::_String_iterator<char,struct
std::char_traits<char>,class std::allocator<char> > __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::begin(void)" (?begin@?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE?AV?$_String_iterator at DU
?$char_traits at D@std@@V?$allocator at D@2@@2 at XZ) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::append(unsigned int,char)" (?append@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV12 at ID@Z)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path_traits.obj) : error
LNK2005: "public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::reserve(unsigned int)"
(?reserve@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEXI at Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??0?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > &&)"
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE@
$$QAV01@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??1?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::operator=(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)" (??4?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAEAAV01 at ABV01@@Z) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Tidy(bool,unsigned
int)" (?_Tidy@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEX_NI at Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: __thiscall std::_String_val<char,class std::allocator<char>
>::_String_val<char,class std::allocator<char> >(class
std::allocator<char>)" (??0?$_String_val at DV?$allocator at D@std@@@std@@QAE at V
?$allocator at D@1@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: __thiscall std::_String_val<char,class std::allocator<char>
>::~_String_val<char,class std::allocator<char> >(void)"
(??1?$_String_val at DV?$allocator at D@std@@@std@@QAE at XZ) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: unsigned int __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::size(void)const "
(?size@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::erase(unsigned
int,unsigned int)" (?erase@?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAEAAV12 at II@Z) already defined
inaoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: char * __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Myptr(void)" (?_Myptr@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEPADXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(path.obj) : error LNK2005:
"public: unsigned int __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::max_size(void)const "
(?max_size@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??0?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > &&)"
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE@
$$QAV01@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??1?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::operator=(char const *)" (??4?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at PBD@Z) already defined
in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::operator=(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(??4?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEAAV01 at ABV01@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Tidy(bool,unsigned
int)" (?_Tidy@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEX_NI at Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: __thiscall std::_String_val<char,class
std::allocator<char> >::_String_val<char,class std::allocator<char> >(class
std::allocator<char>)" (??0?$_String_val at DV?$allocator at D@std@@@std@@QAE at V
?$allocator at D@1@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: __thiscall std::_String_val<char,class
std::allocator<char> >::~_String_val<char,class std::allocator<char>
>(void)" (??1?$_String_val at DV?$allocator at D@std@@@std@@QAE at XZ) already
defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: unsigned int __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::size(void)const " (?size@?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > & __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV12 at II@Z)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: char * __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Myptr(void)" (?_Myptr@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEPADXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_filesystem-vc100-mt-gd-1_46_1.lib(codecvt_error_category.obj) :
error LNK2005: "public: unsigned int __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::max_size(void)const " (?max_size@?$basic_string at DU
?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at ABV01@@Z)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(char const *)" (??0?$basic_string at DU?$char_traits at D
@std@@V?$allocator at D@2@@std@@QAE at PBD@Z) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > &&)"
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE@
$$QAV01@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??1?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAE at XZ) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::erase(unsigned
int,unsigned int)" (?erase@?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAEAAV12 at II@Z) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: unsigned int __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::size(void)const "
(?size@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: void __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Tidy(bool,unsigned
int)" (?_Tidy@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@
@QAEX_NI at Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: char * __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Myptr(void)" (?_Myptr@
?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEPADXZ)
already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: __thiscall std::_String_val<char,class std::allocator<char>
>::_String_val<char,class std::allocator<char> >(class
std::allocator<char>)" (??0?$_String_val at DV?$allocator at D@std@@@std@@QAE at V
?$allocator at D@1@@Z) already defined in aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: __thiscall std::_String_val<char,class std::allocator<char>
>::~_String_val<char,class std::allocator<char> >(void)"
(??1?$_String_val at DV?$allocator at D@std@@@std@@QAE at XZ) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::operator=(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)" (??4?$basic_string at DU?$char_traits at D@std@
@V?$allocator at D@2@@std@@QAEAAV01 at ABV01@@Z) already defined in
aoslcpp.lib(aoslcpp.dll)
1>libboost_system-vc100-mt-gd-1_46_1.lib(error_code.obj) : error LNK2005:
"public: unsigned int __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::max_size(void)const "
(?max_size@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEIXZ)
already defined in aoslcpp.lib(aoslcpp.dll)


Now I don't understand how to fix the problem in the generated code. As said
in my previous email, I tried the solutions suggested in the discussion
without any success.
I also tried to just not generated inline files but it makes compilation
errors with types not found (because it's type-per-file I guess?).

Do you have some suggestions I might try?

If the problem is really about inheriting std::string, how can I change
this?

Joël Lamotte


More information about the xsd-users mailing list