none
std::Xran and std::Xlen Errors RRS feed

  • Question

  • I have seen refferences to these errors previously and information indicates that the errors are a result of library changes from VS 6.0 to 2003 and later.  The only information I have seen for fixing the issue requires rebuilding the libraries.  What is one to do if the libraries are supplied by a vendor and can't be rebuilt?  Is there a plugin, compiler setting, deprecated libraries that can in some way be included that will provide for use with newer versions?

     

    error LNK2001: unresolved external symbol "void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ)
    error LNK2019: unresolved external symbol "void __cdecl std::_Xran(void)" (?_Xran@std@@YAXXZ) referenced in function "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::assign(class std::basic_string,class std::allocator > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z

    error LNK2001: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)
    error LNK2019: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ) referenced in function "private: bool __thiscall std::basic_string,class std::allocator >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAE_NI_N@Z)

    Monday, October 15, 2007 5:44 PM

All replies

  •  

    Let me know if linking also against "libcp.lib" resolves it.

    EDIT: I thought it was just a missing library issue, but this page has the real explanation: http://www.differentpla.net/content/2006/09/unresolved-external-symbol-std-string-base-xran

    Sunday, March 9, 2008 7:53 AM
  • Well, this is about 2 years old. But I just ran into it today, and figured out a potential solution.

    In my case, the issue was that a lib I was using was compiled with VC 9.0, but I was attempting to compile my program with VC 10.0. Downgrading my program compile to VC 9.0 solved the linker errors.

    • Proposed as answer by theambient Tuesday, April 5, 2011 2:28 PM
    Thursday, August 5, 2010 11:12 PM
  • How do you do the downgrade?

    Friday, November 12, 2010 6:14 PM
  • thanks a lot for your answer. I have experienced the same problem. I had both VS 9.0 and 10.0 installed and make bat file which determined version of studio and build some lib.

    This make.bat built version for  9.0 and i tried to build sample withind VS 10.0 and got unresolved links.

     

    changing order for VS version lookup to from newest (10.0) to oldest solved the problem.

     

    P.S. By the way this was library SmartWin++ (just for google).

    • Proposed as answer by theambient Tuesday, April 5, 2011 2:28 PM
    • Unproposed as answer by theambient Tuesday, April 5, 2011 2:28 PM
    Tuesday, April 5, 2011 2:19 PM
  • you can use command line compiler and use needed VS by caling in cmd file for example (put your version here) "%VS90COMNTOOLS%\vsvars32.bat"

     

    Probably bat file will help you.

     

    :: Visual C++ 10.0
    
    if defined VS100COMNTOOLS (
    
    	if exist "%VS100COMNTOOLS%\vsvars32.bat" (
    
    		echo -
    		echo - Visual C++ 10.0 found.
    		echo -
    
    		call "%VS100COMNTOOLS%\vsvars32.bat"
    		goto COMPILE
    	)
    
    )
    
    
    
    :: Visual C++ 9.0
    
    if defined VS90COMNTOOLS (
    
    	if exist "%VS90COMNTOOLS%\vsvars32.bat" (
    
    		echo -
    		echo - Visual C++ 9.0 found.
    		echo -
    
    		call "%VS90COMNTOOLS%\vsvars32.bat"
    		goto COMPILE
    
    	)
    
    )
    
    echo -
    echo - No Visual C++ found, please set the enviroment variable 
    echo - 
    echo - VCToolkitInstallDir or VS71COMNTOOLS or VS80COMNTOOLS 
    echo - 
    echo - to your Visual Studio folder which contains vsvars32.bat.
    echo - 
    echo - Or call the vsvars32.bat.
    echo -
    
    goto ERROR
    
    :COMPILE
    
    :: use cl.exe here
    
    goto LEAVE
    
    : ERROR
    
    echo - Error
    
    :LEAVE

     

     

    Tuesday, April 5, 2011 2:28 PM