none
LNK2019 error basic_string (VC2008)

    Question

  • I checked out a native C++ library project out of TFS.   It used to compile fine but now I get the following linker error:

     

    Error 2 error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Base64::encode(unsigned char const *,int)" (?encode@Base64@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBEH@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl EncryptAndEncode(unsigned char *,int,unsigned char const *,int)" (?EncryptAndEncode@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAEHPBEH@Z) SecureResourceManager.obj SecureResourceManager

     

    The only change I can remember is switching from dynamic version of CRT to static version of CRT.   I thought that STL was part of the dynamic and static versions of the CRT???   What lib do I need to explicitly link in for basic_string support?

     

    thanks

     

     

     

     

    Tuesday, April 29, 2008 3:26 PM

Answers

  • skmcfadden:

    Removing a header file from the solution has no effect, unless you also revove the #include lines that reference it. But when you remove the implementation file you get linker errors.
    Tuesday, April 29, 2008 8:50 PM

All replies

  •  

    Quote>The only change I can remember is switching from dynamic version

    Quote>of CRT to static version of CRT.

     

    If that is the cause of the error, then changing it back to dynamic should

    make the error go away? Did it?

     

    Quote>What lib do I need to explicitly link in for basic_string support?

     

    It's there. What makes you think that the error message relates to the

    string class? Is there an "encode" member function in a class "Base64"?

    Does it take arguments (unsigned char const *,int)?  Is the source for function

    "EncryptAndEncode" accessible to you to check/modify?

     

    - Wayne

     

    Tuesday, April 29, 2008 5:47 PM
  • Oops, some one had removed the Base64 class (header and cpp) from the solution.  Surprised that VS2008 gave me a linker error instead of a compiler error.  Threw me off track.

     

    thanks

     

     

     

     

     

    Tuesday, April 29, 2008 5:59 PM
  • skmcfadden:

    Removing a header file from the solution has no effect, unless you also revove the #include lines that reference it. But when you remove the implementation file you get linker errors.
    Tuesday, April 29, 2008 8:50 PM