Menu

Linking errors when including a TestCase

2002-03-19
2002-04-02
  • Philippe Lavoie

    Philippe Lavoie - 2002-03-19

    I want to include a TestSuite inside my shared DLL. However, when adding a class which inherits from TestCase, I get many linking errors of the form

    msvcprtd.lib(MSVCP70D.dll) : 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in ProcessorRequest.obj

    Those errors are preventing me from exporting a GetTestSuite(TestSuite*) function that will allow me to test all my DLLs.

    I don't have enough experience with Visual C++ to find out what the problem is. I know it's a template instantiation issue but I can't seem to resolve it. I tried to ignore the msvcprtd library but it didn't work.

    Phil

     
    • Mike Krimerman

      Mike Krimerman - 2002-03-20

      If I understand you correctly you should mark your function with __declspec(dllexport)
      Please check the source files for that.

      Are you using the modified H files?

       
    • Baptiste Lepilleur

      Your are probably not using the same run-time libraries. Check the C++/code-genereation tab in the project settings.

      What you want to do is done in:
      cppunit\examples\msvc6\TestPlugIn

      Baptiste.

       
    • Philippe Lavoie

      Philippe Lavoie - 2002-04-02

      You were right Baptiste, there was a conflict in the run-time libraries. Most were using the static versions, but one of them was using the shared version.

      Hard to find when there is a lot of projects involved.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.