Ok this was yet-another-weird-dll thingy, one cannot do:

class GDCM_EXPORT String : std::string { ... }

std::string is already exported (dllexport/dllimport) which was
causing the linker to complain...

As a side note, the free toolkit + a recent PSDK does have all the c
standard libs now. I also fixed two issues:
1. /D NDEBUG should be define for release build
2. Remove exception and rtti flags for the c compiler :)

Thanks
-Mathieu

On Feb 16, 2008 11:33 PM, Mathieu Malaterre <[EMAIL PROTECTED]> wrote:
> Hi there,
>
>   While trying to compile my project in shared libs I realized it was
> not compiling any more with the free C++ toolkit 2003. Looking at
> Windows-cl.cmake the only difference I can see is that each MD flags
> was changed to a MT.
>   So I decided to give it a try with the VCExpress/Nmake one, I choose
> Release and change MD into MT, and again my lib does not compile in
> shared lib mode ON. Is there something I am missing here ? Reading the
> definition of the flags MT I do not see why I should not be able to
> link to shared lib :
>
>   http://msdn2.microsoft.com/en-us/library/2kzt1wy3(VS.71).aspx
>
> As a side note pure-C executable seems to go fine, the real problem
> only occurs with C++ symbols duplicated.
>
> Ref:
> Linking CXX executable ..\..\..\..\bin\gdcmCommonTests.exe
> gdcmCommon.lib(gdcmCommon.dll) : error LNK2005: "public: int
> __thiscall std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::compare(char const *)const " ([EMAIL PROTECTED]
> [EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED])
> already defined in TestFilename.obj
> gdcmCommon.lib(gdcmCommon.dll) : 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)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@V?
> [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]@Z) already defined in 
> TestFilename.obj
> gdcmCommon.lib(gdcmCommon.dll) : error LNK2005: "public: unsigned int
> __thiscall std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::max_size(void)const " ([EMAIL PROTECTED]
> [EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@QBEIXZ)
> already defined in TestDirectory.obj
> gdcmCommon.lib(gdcmCommon.dll) : 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)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@std@@V?
> [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]@Z) already defined in
> TestByteSwap.obj
> TestString.obj : error LNK2019: unresolved external symbol "public:
> static unsigned int const std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >::npos" ([EMAIL PROTECTED]
> [EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@2IB)
> referenced in function "class std::basic_istream<char,struct
> std::char_traits<char> > & __cdecl std::getline<char,struct
> std::char_traits<char>,class std::allocator<char> >(class
> std::basic_istream<char,struct std::char_traits<char> > &,class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > &,char)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@V?
> [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]
> [EMAIL PROTECTED]@std@@@[EMAIL PROTECTED]@[EMAIL PROTECTED]
> [EMAIL PROTECTED]@std@@[EMAIL PROTECTED]@2@@[EMAIL PROTECTED]@Z)
> ..\..\..\..\bin\gdcmCommonTests.exe : fatal error LNK1120: 1
> unresolved externals
>
> And the same issue with nmake/vs2005/MT:
>
>
> Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
> Copyright (C) Microsoft Corporation. Tous droits r
> ..
> Linking CXX executable ..\bin\gdcmconv.exe
> libcpmt.lib(cerr.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)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED])
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(cerr.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)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED])
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(cerr.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 &)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED]@@Z)
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(cerr.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 *)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED]@Z)
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(locale0.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)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED])
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(locale0.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 *)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED]@Z)
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(locale0.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 *)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL 
> PROTECTED]@2@@std@@[EMAIL PROTECTED]@Z)
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(string.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 &)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED]@@Z)
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(string.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)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED])
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> libcpmt.lib(string.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 *)"
> ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL 
> PROTECTED]@Z)
> déjà défini(e) dans gdcmMSFF.lib(gdcmMSFF.dll)
> ..\bin\gdcmconv.exe : fatal error LNK1169: un ou plusieurs symboles
> définis à différentes reprises ont été rencontrés
> NMAKE : fatal error U1077: 'C:\PROGRA~1\MID05A~1\VC\bin\cl.exe' : code
> retour '0x2'
> Stop.
> NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio
> 8\VC\BIN\nmake.exe"' : code retour '0x2'
> Stop.
> NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio
> 8\VC\BIN\nmake.exe"' : code retour '0x2'
> Stop.
>
> Thanks !
> --
> Mathieu
>



-- 
Mathieu

Attachment: free.patch
Description: Binary data

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to