I am a newbie in C++ and getting the below error while compiling an old C++ application. On reading various posts here, my understanding is that the function call might be missing some parameters. Now, the function is a part of static library. How do I identify the missing parameters? Or is (enough) required information there in the error message below?
rfcclass.lib(crfcglob.obj) : error LNK2019: unresolved external symbol
"class std::basic_ostream > & __cdecl std::operator<<(class
std::basic_ostream > &,char const *)"
(??6std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
referenced in function "public: __thiscall
CRfcTrace::~CRfcTrace(void)" (??1CRfcTrace##QAE#XZ)
Thanks.
Related
There is an abandoned project, that builds correctly in 32bit version, but I need 64bit version of it. I tried to change project setting to x64 in visual studio, but when I click build I get lots of errors. Here are the visual studio files. And here is more info about the project. I have no experience with VS and c++.
This is a DLL, that makes connection between MT5 platform and MySQL, using libmysql.dll. I would like to read and write data to/from MySQL using MT5.
I would appreciate if you could help me to convert this to 64 bits, the 32 bit version can not be loaded to MT5.
Here are the first 5 error:
1>MQLMySQL.obj : error LNK2019: unresolved external symbol mysql_num_rows referenced in function "int __cdecl cMySqlCursorRows(int)" (?cMySqlCursorRows##YAHH#Z)
1>MQLMySQL.obj : error LNK2019: unresolved external symbol mysql_num_fields referenced in function "wchar_t * __cdecl cMySqlGetRowField(int,unsigned int)" (?cMySqlGetRowField##YAPEA_WHI#Z)
1>MQLMySQL.obj : error LNK2019: unresolved external symbol mysql_errno referenced in function "bool __cdecl MySqlExecute(int,wchar_t *)" (?MySqlExecute##YA_NHPEA_W#Z)
1>MQLMySQL.obj : error LNK2019: unresolved external symbol mysql_error referenced in function "bool __cdecl MySqlExecute(int,wchar_t *)" (?MySqlExecute##YA_NHPEA_W#Z)
1>MQLMySQL.obj : error LNK2019: unresolved external symbol mysql_init referenced in function "int __cdecl cMySqlConnect(wchar_t *,wchar_t *,wchar_t *,wchar_t *,int,wchar_t *,int)" (?cMySqlConnect##YAHPEA_W000H0H#Z)
1>MQLMySQL.obj : error LNK2019: unresolved external symbol mysql_real_connect referenced in function "int __cdecl cMySqlConnect(wchar_t *,wchar_t *,wchar_t *,wchar_t *,int,wchar_t *,int)" (?cMySqlConnect##YAHPEA_W000H0H#Z)
From the first 5 errors you've had, it looks like a linker issue. Most compiled languages compile the source (c++) code into object files and then link them with existing libraries. If the source compiles, but you can't link to the external libraries (for example they aren't installed) then you'll get errors like you've described.
Is there an external library that you need to reference, or are all of your source files organized in such a way that they can reference each other?
I really hate this problem that the compiler tells me
"err LNK2019: Reference to unresolved external symbol".
Unlike other compiler errors, I can not jump to this problem by double-clicking it.
It always takes me a tremendous amount of time to figure out what I did wrong.
For example, from the error message
Error 9 error LNK2019: Reference to unresolved symbol ""public: class std::vector<unsigned char,class std::allocator<unsigned char> > & __thiscall clsJoinBigUnsignedCharMap::Content(void)" (?Content#clsJoinBigUnsignedCharMap##QAEAAV?$vector#EV?$allocator#E#std###std##XZ)" in Funktion ""private: void __thiscall CCompiler::pSerializeJoinBigUnsignedCharMap(class clsJoinBigUnsignedCharMap &,struct _iobuf *)" (?pSerializeJoinBigUnsignedCharMap#CCompiler##AAEXAAVclsJoinBigUnsignedCharMap##PAU_iobuf###Z)". m:\compiler.obj voice
I can not see at all where I should look for the error.
Am I missing something here? I don't see where the error is located, and the fact that I can not jump to the problem by double-clicking it indicates to me that VS2010 does not know either.
Thank you for the help.
Your CCompiler::pSerializeJoinBigUnsignedCharMap (from compiler.obj) is using a method (clsJoinBigUnsignedCharMap::Content()) that's defined in a header, but not implemented within any of the linked source files.
If you read the message it says:
in Funktion ""private: void __thiscall CCompiler::pSerializeJoinBigUnsignedCharMap(class clsJoinBigUnsignedCharMap &,struct _iobuf *)"
so in the function CCompiler::pSerializeJoinBigUnsignedCharMap,
there is a unreferenced symbol
clsJoinBigUnsignedCharMap::Content(void)
the linker cannot link with clsJoinBigUnsignedCharMap::Content, it has no compiled code for it.
Yesterday I got this linker error. I have searched on google and msdn without success.
My problem:
I have moved some parts of my cpp project in a extern static library. I added the h file to my main project and added the dependencies to the lib files. Unfortunately I get a lot linker errors.
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NFile::NFind::CFileInfo::Find(unsigned short const *)" (?Find#CFileInfo#NFind#NFile#NWindows##QAE_NPBG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: class NWindows::NCOM::CPropVariant & __thiscall NWindows::NCOM::CPropVariant::operator=(unsigned short const *)" (??4CPropVariant#NCOM#NWindows##QAEAAV012#PBG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CInFileStream::Open(unsigned short const *)" (?Open#CInFileStream##QAE_NPBG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NFile::NIO::COutFile::Create(unsigned short const *,bool)" (?Create#COutFile#NIO#NFile#NWindows##QAE_NPBG_N#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "void __cdecl ConvertUInt32ToString(unsigned int,unsigned short *)" (?ConvertUInt32ToString##YAXIPAG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NDLL::CLibrary::Load(unsigned short const *)" (?Load#CLibrary#NDLL#NWindows##QAE_NPBG#Z)
All this methods a part of my extern lib. I have tries a lot of compiler settings without success.
Further more when I remove the lib dependencie completely from the linker I get 26 LNK2001 error. So the linker finds only "parts" of the lib.
Do I use a wrong compiler / linker option for my projects?
edit:
The problem was the parameter define LPCTSTR of the method CLibrary::Load(LPCTSTR fileName). In my lib I set the option "Treat wchar_t as build-in type (Properties->C/C++->Lanuage-> ... ) to No. And now it works.
There's not enough information in the question so my answer merely serves as a guide.
Take one function, for instance bool NWindows::NFile::NFind::CFileInfo::Find(unsigned short const *) and find definition of it in your code. Is it there? With this exact function signature? Is it in unnamed namespace? Is it declared static in source file?
Also, try full rebuild of everything. You'd be surprised how many times full rebuild makes mysterious problems go away.
Error 10 error LNK2001: unresolved external symbol "public: virtual void __thiscall MPPostProcess::prepareForProcess(void)" (?prepareForProcess#MPPostProcess##UAEXXZ) D:\Prj\MagicLib\MagicLib\dllmain.obj MagicLib
Error 11 error LNK2001: unresolved external symbol "public: virtual void __thiscall MPPostProcess::prepareForProcess(void)" (?prepareForProcess#MPPostProcess##UAEXXZ) D:\Prj\MagicLib\MagicLib\MPImageData.obj MagicLib
Error 12 error LNK2019: unresolved external symbol "private: virtual __thiscall PPBlackAndWhite::~PPBlackAndWhite(void)" (??1PPBlackAndWhite##EAE#XZ) referenced in function "private: virtual void * __thiscall PPBlackAndWhite::`scalar deleting destructor'(unsigned int)" (??_GPPBlackAndWhite##EAEPAXI#Z) D:\Prj\MagicLib\MagicLib\dllmain.obj MagicLib
How to cure this?
There are 2 likely candidates for unresolved external errors:
If you defined the MPPostProcess class, then you have probably forgot to provide an implementation for the prepareForProcess(void) and ~PPBlackAndWhite(void) functions.
If the MPPostProcess class is a class you are using provided by an external library, then you need to link to the library that provides those functions
You probably haven't provided definitions for prepareForProcess() or ~PPBlackAndWhite().
I am getting a bunch of linking errors while trying to link the release version of an executable(debug version does not have the same issue). Comparing the command line for the link does not reveal any issues.
there are broadly 2 types of errors neither of which I can get a handle on.
The first kind complains about a unresolved external symbol _declspec(dllimport)
As an example:
error LNK2019: unresolved external symbol
"_declspec(dllimport)
public: __thiscall
stlpd_std::basic_string,class stlpd_std::allocator >::basic_string,class stlpd_std::allocator >(class stlpd_std::basic_string,class stlpd_std::allocator > const &)" (_imp??0?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std##QAE#ABV01##Z) referenced in function "public: __thiscall Springfield::generic::runtime_error::runtime_error(class stlpd_std::basic_string,class stlpd_std::allocator > const &)" (??0runtime_error#generic#Springfield##QAE#ABV?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std###Z)
for a more human readable version(replacing all the strings):
error LNK2019: unresolved external symbol
"__declspec(dllimport)
public: __thiscall
string::basic_string,class stlpd_std::allocator >(class string const &)" (_imp??0?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std##QAE#ABV01##Z) referenced in function "public: __thiscall Springfield::generic::runtime_error::runtime_error(class string const &)" (??0runtime_error#generic#Springfield##QAE#ABV?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std###Z
The sceond class of errors complains about
unresolved external symbol __CrtDbgReportW
I hope I can get some kind of insight in dealing with this.
From the errors it looks like you are not including the CRT as one of your linked libraries. Here is a link to the different CRT lib's offered in Visual Studio 2005. Choose the one which is most appropriate and make sure it's in the list of lib's to link against
http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx
It looks like you're either including a file that's been built using the debug settings or you're mixing runtime libraries (DLL and static).