Hi, I am having trouble getting the testsuite project to compile... Here is what I have done so far:
++Check out latest version of quantlib ++Open dsw in VS2002; auto convert workspace/projects to new VS2002 format ++Build OnTheEdgeDebug all projects - Quantlib and 4 examples go fine, testsuite fails (details below)
Cppunit: My installation for cppunit is: ++download v1.8.0 tarball ++open dsw in VS2002; autoconvert ++Batch build all configs - only 4 out of 9 configs complete, but cppunit.lib and cppunitd.lib appear in the lib directory... ++Add cppunit lib and include dirs to my VS2002 default include and lib directory list
Here's the error message that I get when trying to build testsuite: (actually the linker error using /VERBOSE:LIB)
Linking... Searching libraries Searching C:\dev\cppunit\cppunit-1.8.0\lib\cppunitd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\odbc32.lib:
<SNIP,SNIP>
Searching \src\vendor\QL-current\QuantLib\lib\Win32\VisualStudio\QuantLib_d.lib: Searching \dev\cppunit\cppunit-1.8.0\lib\cppunitd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\libcpmtd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\LIBCMTD.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\OLDNAMES.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\msvcprtd.lib: msvcprtd.lib(MSVCP70D.dll) : 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in calendars.obj
<SNIP,SNIP - about 15 more similar errors>
MSVCRTD.lib(MSVCR70D.dll) : error LNK2005: "public: char const * __thiscall type_info::name(void)const " (?name@type_info@@QBEPBDXZ) already defined in LIBCMTD.lib(typname.obj) MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj) MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj) Searching C:\dev\cppunit\cppunit-1.8.0\lib\cppunitd.lib:
<SNIP,SNIP>
Searching \src\vendor\QL-current\QuantLib\lib\Win32\VisualStudio\QuantLib_d.lib: Searching \dev\cppunit\cppunit-1.8.0\lib\cppunitd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\libcpmtd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\LIBCMTD.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\OLDNAMES.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\msvcprtd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\MSVCRTD.lib: Searching C:\dev\cppunit\cppunit-1.8.0\lib\cppunitd.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\Platf ormSDK\lib\odbc32.lib: Searching C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\odbccp32.lib: Finished searching libraries LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library .\build\OnTheEdgeDebug/testsuite.exe : fatal error LNK1169: one or more multiply defined symbols found
------------------------------------------------------------------------------------------------------------------------
I can't tell you how much I hate tracking down these multiple def issues... But my obvious thought was that the cppunit lib's were linking to some incompatible runtime lib, but looking a the cppunit project files things looked correct (could be wrong though...). My next suspicion was the redef errors had to do with std::string and rtti so maybe this is some quirk of MSVC's silly template support, but that's really just a stab in the dark.
Incidentally I tried building both cppunit and quantlib in VC6 - for cppunit all 9 configs succeeded, but testsuite still had similar linker errors to what's above. (also there are a few compiler warnings that VC7 emits but vc6 does not)
Anyone have thoughts on things I could try to track this problem down?
Thanks, nehal
|
Nehal,
multiple definition problems like the ones you describe are usually the result of different settings in the two projects. I don't know if the layout of the settings stayed the same for VC7, however, in VC6 you should check that under the tab "C/C++" and the pull-down menu "Code generation" that both project specify the same run-time libraries. Later, Luigi |
In reply to this post by Nehal Patel
At 02:24 PM 7/24/2003 -0400, Nehal Patel wrote:
> I am having trouble getting the testsuite project to > compile... Here is what I have done so far: >[...] > Incidentally I tried building both cppunit and quantlib in VC6 - for > cppunit all 9 configs succeeded, but testsuite still had similar linker > errors to what's above. (also there are a few compiler warnings that VC7 > emits but vc6 does not) > >Anyone have thoughts on things I could try to track this problem down? I currently use cppunit for the QuantLib test suite with no problem in VC6. I had to tweak something in the project settings of cppunit. I don't remember what, but it must have been run-time libraries, exception handling, and RTTI in order to synch them with QuantLib setting. The relevant project of the cppunit workspace is cppunit.dsp. Should you still have problem email me off list and we can figure out which setting need tweaking. I expect you will provide unit test for SVD and MC American options in return ;-) ------------ ciao -- Nando |
In reply to this post by Nehal Patel
Things like this always require a good night's sleep before they get
resolved... Anyway, with a fresh mind this morning and upon a slightly more thorough examination I noticed that cppunit.dsp is uses the multi-threaded, DLL version of the runtime library but the various quantlib projects use the multi-threaded, __statically linked__ versions. Changing cppunit.dsp to be consistent with quantlib solves my problems and testsuite complies, but... The 0.3.1 release uses the multi-threaded, __dll__ runtimes. I guess somewhere between that release and now, the projects in cvs started using the static link versions. Was there a particular reason for this? I'm definitely not a great expert at this, but my guess is that most other external libraries will come configured to used the MT/DLL runtimes. Of course, I suppose each user can tweak these setting to their particular needs, but it seems like keeping the DLL runtimes might be a good choice for the default. Anyway, off I go to tackle building Quantlib/SWIG. Take care, nehal -----Original Message----- From: Ferdinando Ametrano [mailto:[hidden email]] Sent: Friday, July 25, 2003 3:59 AM To: Nehal Patel; '[hidden email]' Subject: Re: [Quantlib-users] problem compiling testsuite project At 02:24 PM 7/24/2003 -0400, Nehal Patel wrote: > I am having trouble getting the testsuite project to > compile... Here is what I have done so far: >[...] > Incidentally I tried building both cppunit and quantlib in VC6 - for > cppunit all 9 configs succeeded, but testsuite still had similar linker > errors to what's above. (also there are a few compiler warnings that VC7 > emits but vc6 does not) > >Anyone have thoughts on things I could try to track this problem down? I currently use cppunit for the QuantLib test suite with no problem in VC6. I had to tweak something in the project settings of cppunit. I don't remember what, but it must have been run-time libraries, exception handling, and RTTI in order to synch them with QuantLib setting. The relevant project of the cppunit workspace is cppunit.dsp. Should you still have problem email me off list and we can figure out which setting need tweaking. I expect you will provide unit test for SVD and MC American options in return ;-) ------------ ciao -- Nando |
At 09:32 AM 7/25/03 -0400, Nehal Patel wrote:
>Anyway, with a fresh mind this morning and upon a slightly more thorough >examination I noticed that cppunit.dsp is uses the multi-threaded, DLL >version of the runtime library but the various quantlib projects use the >multi-threaded, __statically linked__ versions. Changing cppunit.dsp to be >consistent with quantlib solves my problems and testsuite complies, but... > >The 0.3.1 release uses the multi-threaded, __dll__ runtimes. I guess >somewhere between that release and now, the projects in cvs started using >the static link versions. Was there a particular reason for this? I'm >definitely not a great expert at this, but my guess is that most other >external libraries will come configured to used the MT/DLL runtimes. Of >course, I suppose each user can tweak these setting to their particular >needs, but it seems like keeping the DLL runtimes might be a good choice for >the default. Adding a couple of configurations to the project (workspace?) should do the trick, shouldn't it? Not that I'm doing it, you know :) Cheers, Luigi |
Free forum by Nabble | Edit this page |