Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tuesday, June 3, 2014 9:54 AM
Hello Developers,
I developed a Static library project in "Visual Studio 2005" compiler and trying to add this static library in a "Visual C++ 6.0" project and trying to compile. I am getting below linking errors.
Deleting intermediate files and output files for project 'CIO_Test_Client_VC60 - Win32 Debug'.
Configuration: CIO_Test_Client_VC60 - Win32 Debug
Compiling...
Dll_Micro_Client.cpp
Linking...
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
FMS_CIO_Static_Lib.lib(demo1.obj) : error LNK2001: unresolved external symbol __RTC_Shutdown
FMS_CIO_Static_Lib.lib(demo1.obj) : error LNK2001: unresolved external symbol __RTC_InitBase
Debug/CIO_Test_Client_VC60.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
CIO_Test_Client_VC60.exe - 3 error(s), 2 warning(s)
I found some solution that, adding msvcrt.lib and msvcmrt.lib in "Visual C++ 6.0" project will solve this issue. I tried the same, but still errors are coming.
Please do let me know why this errors are coming and how to resolve it ???
Thanks in advance.
Thanks,
Anand.
Tuesday, June 3, 2014 1:30 PM ✅Answered
Try with a release build or try turning off "Basic Runtime Checks" in the VS2005 project (see project properties, C/C++, code generation). Also, make sure that both the VC6 project and the VS2005 project use the same CRT option (static or DLL).
That said, what you're trying to is unsupported. Even if it does compile there's no guarantee that it will run correctly.
Tuesday, June 3, 2014 1:55 PM ✅Answered
All I can say is -- that direction lies madness. You need to upgrade the project to 2005 or downgrade the library to VC6, that is the only sane approach. Even if you somehow make the project compile and link seem to work I would be lying awake every night waiting for the inevitable random crashes that will happen when the project is deployed.
Tuesday, June 3, 2014 10:14 AM
What you're trying to do makes no sense, static libraries are supposed to be used with the same compiler/linker that was used to create them. In some cases they may also work with a newer compiler but with an older compiler you're simply asking for trouble.
Use a dll if you really must mix code produced by different compiler versions. And make sure that you do not pass C/C++ runtime specific objects such as STL containers or C FILE streams across the dll boundary.
Tuesday, June 3, 2014 12:20 PM
Thanks Mike Danes.
I have some specific requirements, that's why i am trying that.
Any idea or workaround for that ? By adding any windows specific lib to Visual C++ 6.0, can it be resolved ???
Thanks,
Anand.