stl link errors

Hi all,

I'm getting some stl::basic_string link errors which I have been unable to track down.

Here is an example:

>Node.obj : error LNK2001: unresolved external symbol "public: static unsigned int const std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::npos" ( npos@ $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@2IB)

I am using VS2005 with Windows Mobile 5.0 Pocket PC SDK (ARMV4I).

Now, it links fine in Debug, but not in Release. I can't see anything that pops out at me when I check the differences between the Debug and Release configurations. My Release configuration is compiled with /MD and my Debug configuration is compiled with /MDd.

I can't show any code samples since I don't know what the offending code it - I don't use npos in any of my code.

Is this a known bug Am I missing a library to link in

I am linking in other dlls and static libs. Do they all have to be compiled with /MD even if they are static In Debug and in regular VS2005 the static libs use /MT and they seem to link just fine...

Any help would be appreciated, thanks.




Answer this question

stl link errors

  • Dumondo

    Hi,

    I did that with all my components and it still didn't work...



  • paulpayne

    It would be a good idea to try and link all parts with the same model - e.g. use /MDDrinks for all of them

  • Kathirvel

    From what I'm seeing that sounds like it could be the issue.

    Thanks for confirming it.

     



  • Lj47

    AFAIK MFC and ATL are being merged to a certain extent in VC 8.0. That could be the reason

  • devinr

    OK, I finally tracked it down.

    I needed to add the following to the files which had the link problem:

    #ifndef _AFX_NO_AFXCMN_SUPPORT

    #include <afxcmn.h> // MFC support for Windows Common Controls

    #endif // _AFX_NO_AFXCMN_SUPPORT

    I also had to add: "Use MFC in a shared DLL" to the project which didn't have it before.

    I am not sure why I have to add an MFC header to get STL code to link...is this a bug Have I missed something else



  • stl link errors