I am trying to build a console project using Microsoft Visual C++ 2008 Express. I included a static third-party library (no source code available) by adding the name to the Additional Dependencies (in Project Properties\Linker\Input). Additionally, I added the path of the folder where the ThirdPartyLib.lib is to the Tools\ProjectsAndSolutions\Directories for Library Files\. And finally, I included it in my main.cpp with:
#pragma comment(lib, "THIRDPARTYLIB_Application.lib").

When trying to build the project in the debug mode, I get following warnings and errors:

1>Linking...
1> ThirdPartyLib_Application.lib(ThirdPartyLibApplicationBase.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>   Creating library C:\ Documents\Visual Studio 2008\Projects\ThirdPartyLib_Example\Debug\ ThirdPartyLib_Example.lib and object C:\ Documents\Visual Studio 2008\Projects\ ThirdPartyLib_Example\Debug\ ThirdPartyLib_Example.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>ThirdPartyLib_Application.lib(binary_oarchive.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) const std::locale::facet::`vftable'" (__imp_??_7facet@locale@std@@6B@)
1>ThirdPartyLib_Application.lib(binary_iarchive.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) const std::locale::facet::`vftable'" (__imp_??_7facet@locale@std@@6B@)
1>ThirdPartyLib_Application.lib(binary_oarchive.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static unsigned int __cdecl std::codecvt<char,char,int>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z)
1>ThirdPartyLib_Application.lib(binary_iarchive.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static unsigned int __cdecl std::codecvt<char,char,int>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z)
1>ThirdPartyLib_Application.lib(ThirdPartyLibEnabledObjects.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::replace(class std::_String_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::_String_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@V?$_String_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@2@0ABV12@@Z)
1>ThirdPartyLib_Application.lib(ThirdPartyLibEnabledObjects.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static unsigned int __cdecl std::numpunct<char>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z)
1>C:\Documents\Visual Studio 2008\Projects\ ThirdPartyLib_Example\Debug\ ThirdPartyLib_Example.exe : fatal error LNK1120: 4 unresolved externals
1> ThirdPartyLib _Example - 7 error(s), 2 warning(s)

However, when trying to build the project in the release mode, I get only one new error (and no warnings):

1>fatal error C1047: The object or library file 'C:\Documents\Visual Studio 2008\Projects\ThirdPartyLib_Example\lib\ThirdPartyLib_Application.lib' was created with an older compiler than other objects; rebuild old objects and libraries
1>LINK : fatal error LNK1257: code generation failed

Please give me an idea how to successfully build the project?! Can I do it without the source code for the third-party library? Thank you very much for any hint!

That's a problem with static libraries.
Does the provider have an updated version?

Can you use an older compiler -- at least enough to get that to link into a DLL that exposes its methods?

That's a problem with static libraries.
Does the provider have an updated version?

I am trying to get to them to find out. Still no answer. Do you think that if the static library was re-compiled with the visual express I am using - the errors I am getting would be eliminated?

Can you use an older compiler -- at least enough to get that to link into a DLL that exposes its methods?

I don't have an older compiler, but if that would help me, I would download it. So, please correct me if I am wrong: I should "convert" the third-party library into a DLL using some previous version of Visual Express (the one used in the first place to compile the *.lib?) and then would be possible to see its methods? If that's correct, how can I know which compiler version do I need? And why would the exposure of the methods solve the problem?

...not necessarily VS Express, but yes, something newer.

If you can get the provider to re-compile it with VS2010 (or even Express), that would help.

I'm going to see if I can find an old .LIB file created with VC++ 6 to see what I can convert.

I probably won't be able to get the third-party library recompiled with some newer version. Does anybody have any ideas how to fix these errors? Thank you!

This article has been dead for over six months. Start a new discussion instead.