agustin_m

Hello,

I have a project that was created/build using VC++ 6.0, the project uses a third party library iconnect.lib that was created with VC++ 6.0. I am trying to compile the project using VC++ 8.0 but I get a lot of linker errors - some of those errors are below. Note: the project compiles without errors or warnings when using VC++ 6.0.

Can someone tell me what I need to do to get my project to compile/link successfully with VC++ 8.0

Thanks in advance!

-Agustin

ERRORS:

Error 82 error LNK2001: unresolved external symbol __RTC_CheckEsp iconnect.lib
Error 83 error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl toAmountString(double)" ( toAmountString@@YA AV $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@N@Z) iconnect.lib
Error 164 error LNK2001: unresolved external symbol __RTC_CheckEsp SampleMsgHandler.obj
Error 165 error LNK2001: unresolved external symbol __RTC_Shutdown iconnect.lib
Error 168 error LNK2019: unresolved external symbol __RTC_Shutdown referenced in function "private: void __thiscall iConnect::iCTradeExtensionEuroRepo::_unpack_str2DealRefEuro(class iConnect::iCMessageBuffer &)" ( _unpack_str2DealRefEuro@iCTradeExtensionEuroRepo@iConnect@@AAEXAAViCMessageBuffer@2@@Z) iconnect.lib
Error 169 error LNK2001: unresolved external symbol __RTC_Shutdown iconnect.lib
Error 329 error LNK2001: unresolved external symbol __RTC_InitBase iconnect.lib
Error 411 error LNK2019: unresolved external symbol __RTC_InitBase referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl toAmountString(double)" ( toAmountString@@YA AV $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@N@Z) iconnect.lib
Error 412 error LNK2001: unresolved external symbol __RTC_InitBase iconnect.lib
Error 493 error LNK2001: unresolved external symbol ___security_cookie Simple.obj
Error 494 error LNK2019: unresolved external symbol ___security_cookie referenced in function "protected: virtual void __thiscall CSample::onConnect(class iConnect::iCSession &)" ( onConnect@CSample@@MAEXAAViCSession@iConnect@@@Z) Sample.obj
Error 495 error LNK2001: unresolved external symbol ___security_cookie SampleCommands.obj
Error 498 error LNK2001: unresolved external symbol ___CxxFrameHandler3 Simple.obj
Error 499 error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$ onConnect@CSample@@MAEXAAViCSession@iConnect@@@Z Sample.obj
Error 500 error LNK2001: unresolved external symbol ___CxxFrameHandler3 SampleCommands.obj
Error 503 error LNK2001: unresolved external symbol @__security_check_cookie@4 Simple.obj
Error 504 error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function __ehhandler$ onConnect@CSample@@MAEXAAViCSession@iConnect@@@Z Sample.obj
Error 505 error LNK2001: unresolved external symbol @__security_check_cookie@4 SampleCommands.obj
Error 508 error LNK2019: unresolved external symbol @_RTC_CheckStackVars@8 referenced in function "public: virtual void __thiscall iConnect::iCBankDetail::dump(class std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)const " ( dump@iCBankDetail@iConnect@@UBEXAAV $basic_ostringstream@DU $char_traits@D@std@@V $allocator@D@2@@std@@@Z) iconnect.lib
Error 509 error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8 iconnect.lib
Error 650 error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8 Sample.obj
Error 651 error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8 SampleCommands.obj
Error 652 error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8 SampleLog.obj
Error 653 error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8 SampleMsgHandler.obj
Error 654 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (__imp_ _Osfx@ $basic_ostream@DU $char_traits@D@std@@@std@@QAEXXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" ( 1sentry@ $basic_ostream@DU $char_traits@D@std@@@std@@QAE@XZ) Sample.obj
Error 655 error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (__imp_ _Osfx@ $basic_ostream@DU $char_traits@D@std@@@std@@QAEXXZ) SampleCommands.obj
Error 656 error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (__imp_ _Osfx@ $basic_ostream@DU $char_traits@D@std@@@std@@QAEXXZ) SampleLog.obj
Error 657 error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (__imp_ _Osfx@ $basic_ostream@DU $char_traits@D@std@@@std@@QAEXXZ) SampleMsgHandler.obj
Error 658 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (__imp_ _Lock@ $basic_streambuf@DU $char_traits@D@std@@@std@@QAEXXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Sentry_base::_Sentry_base(class std::basic_ostream<char,struct std::char_traits<char> > &)" ( 0_Sentry_base@ $basic_ostream@DU $char_traits@D@std@@@std@@QAE@AAV12@@Z) Sample.obj
Error 659 error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (__imp_ _Lock@ $basic_streambuf@DU $char_traits@D@std@@@std@@QAEXXZ) SampleCommands.obj
Error 667 error LNK2001: unresolved external symbol "__declspec(dllimport) 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> >(char const *)" (__imp_ 0 $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@QAE@PBD@Z) iconnect.lib
Error 668 error LNK2001: unresolved external symbol "__declspec(dllimport) 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> >(char const *)" (__imp_ 0 $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@QAE@PBD@Z) iconnect.lib
Error 902 error LNK2019: unresolved external symbol "__declspec(dllimport) 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> >(char const *,unsigned int)" (__imp_ 0 $basic_string@DU $char_traits@D@std@@V $allocator@D@2@@std@@QAE@PBDI@Z) referenced in function "public: class iConnect::iCMessageBuffer & __thiscall iConnect::iCMessageBuffer::operator>>(class iConnect::flstring &)" ( 5iCMessageBuffer@iConnect@@QAEAAV01@AAVflstring@1@@Z) iconnect.lib
Error 903 error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: int __thiscall iConnect::WSALib::init(void)" ( init@WSALib@iConnect@@QAEHXZ) iconnect.lib
Error 904 error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: int __thiscall iConnect::WSALib::fini(void)" ( fini@WSALib@iConnect@@QAEHXZ) iconnect.lib




Re: Visual C++ General Compiling a VC++ 6.0 with VC++ 8.0

Peter Ritchie

You need to the the third-party library for VC++ 8.0 from the vendor. Visual C++ does not support linking libraries that use one version of the CRT with code that uses another verstion of the CRT.




Re: Visual C++ General Compiling a VC++ 6.0 with VC++ 8.0

agustin_m

Peter,

Thanks your reply!

The company that provides the iconnect.lib library does not have a VC++ 8.0 version of the library, they only have 6.0 and 7.0. Do you have any other suggestion

Your help is very appreciated!

-Agustin






Re: Visual C++ General Compiling a VC++ 6.0 with VC++ 8.0

Ted.

Another suggestion would be to isolate the functionality you require from this iconnect.lib into a separate DLL. Include this iconnect.lib when linking your new DLL. Create export stub functions in this DLL that the rest of your app can call. Link the new DLL with VC 6.0.

So your main app is in VC8.0, and the isolated functionality you require is in VC 6.0. The import library created by your VC 6.0 DLL will be compatible with the rest of your app.





Re: Visual C++ General Compiling a VC++ 6.0 with VC++ 8.0

Peter Ritchie

There's nothing supported you can do to link a lib linked to a different CRT. The problem is that lib is linked to CRT symbols that may or may not be in the new CRT you're linking your application with.

As Ted points out, about the only thing you can do is create a VC6 DLL statically linked to the CRT (or VC7 if you can upgrade your lib to a more recent version) that exposes the functionality of the lib via an alternative interface.

I would complain loudly to the vendor, if they're providing libraries for use with Visual Studio they should produce libraries for current/new versions of Visual Studio in a timely fashion.




Re: Visual C++ General Compiling a VC++ 6.0 with VC++ 8.0

agustin_m

Peter and Ted,

Thanks for your input!

I do have a DLL version of the iconnect.lib along with the .lib file to link it with - this was provided by the vendor. I can compile and link using VC++ 8.0 when I use the DLL .lib file but when I run the app I get that 2 other DLL can not be found these are: msvcr70d.dll and MSVCP70.dll.

I downloaded these DLL from the internet placed then in the app folder and I now get this error:

Unhandled exception at 0x7c812a5b in Simple_cpp.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f0e4..

This is the code for the main function:

int main(int argc, char** argv)

{

// Sample class for session handling,

// implements callbacks from iCallback

CSample sample;

// Process command line options

CSampleCommands cmds;

if (! cmds.processCommand(argc, argv) )

{

printf( "Usage: %s [-h host:port] [-u username:passwd] [-l loglvl] [-c request:param:...]\n", argv[0] );

while (getchar() != '\n');

return 1;

}

// Create a new session

// add sample as callback to handle received events and messages for the session

iCSession* pSession = &iCSessionMngr::getMngr()->createSession(cmds.getUsername(), cmds.getPassword(), cmds.getHost(), cmds.getPort),&sample );

return 0;

}

-Agustin