I'm trying to do a build on an open source project www.quickfixengine.org and getting some errors. The code is unmodified from when I downloaded it. I just brought it into Visual C++ so this should work.
Here's the output:
1>------ Build started: Project: at, Configuration: Debug Win32 ------
1>Linking...
1>quickfix.lib(MSXML_DOMDocument.obj) : error LNK2019: unresolved external symbol "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" ( ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) referenced in function "public: __thiscall _bstr_t::Data_t::Data_t(char const *)" ( 0Data_t@_bstr_t@@QAE@PBD@Z)
1>quickfix.lib(MSXML_DOMDocument.obj) : error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)" ( ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function "public: char const * __thiscall _bstr_t::Data_t::GetString(void)const " ( GetString@Data_t@_bstr_t@@QBEPBDXZ)
1>bin\debug\at.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\centurion.PAXNY\Desktop\quickfix-1.10.2_NEW\quickfix\Debug\BuildLog.htm"
1>at - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

error LNK2019 related to ConvertStringToBSTR
Nitramsen
I had the exact same problem, and I resolved it with these five code lines:
// File lib da includere per la corretta compilazione e linkaggio del file
#ifdef
_DEBUG# pragma
comment(lib, "comsuppwd.lib")#else
# pragma comment(lib, "comsuppw.lib")
#endif
# pragma
comment(lib, "wbemuuid.lib")I think that this trick could be useful for many developers... Bye everybody! ...and sorry for my poor english...
TheViking
Hello,
I am also seeing the same problem. I am building the program using Visual Studio 2005 PRO for x64.
I have added the path to the comsupp.lib for x64 in the Directories under "options".
It still returns the same linker error. Also, I have also added the path under Linker\Inputs but the error still occurs.
Any other pointers
Thanks,
Sonia.
Joyce_David
thinhbui
J B
Hello,
I met the problem and i try both solution to fix the issue :
Both solution are working correctly.
I just want to precise some point :
This issue appear after VS2005 SP1 installation.
This issue appear an an old project create on VS6 migrate to VS2003 to VS2005 and finaly build on SP1.
In my opinion It seems more relevant to use the second approach using /Zc:char_t compiler setting than the fist one. I interest in thinking about the best solution.
Michel
AngeloB
In VS2005.
Try to link "comsuppwd.lib" in debug AdditionalDependencies.
Link "comsuppw.lib" in release AdditionalDependencies.
Reference: http://msdn2.microsoft.com/en-us/library/t58y75c0.aspx
Spyke555
When calling a function in a static library or DLL that takes a wchar_t type (note that BSTR and LPWSTR resolve to wchar_t*), you may get an LNK2001 unresolved external symbol error.
This error is caused by the /Zc:wchar_t compiler option, which is set to on by default in new MFC projects. This option causes the compiler to treat wchar_t as a native type. Before Visual C++ .NET, wchar_t was treated as an unsigned short.
If the main project and library do not use the same setting for /Zc:wchar_t, this will cause a mismatch of function signatures. To avoid this problem, rebuild the library with the /Zc:wchar_t compiler option, or turn it off in the main project using the Treat wchar_t as Built-in Type setting on the Language property page in the Property Pages dialog box.
MikeJohnson
rkewish
I still cannot get this to compile.
Sidney Buss
#ifdef _DEBUG
# pragma comment(lib, "comsuppwd.lib")
#else
# pragma comment(lib, "comsuppw.lib")
#endif
# pragma comment(lib, "wbemuuid.lib")
that worked like a charm. right in stdafx.h under a #pragma once.
thank-you
rankorn