all
I am very new to C++.
But I have used C# as my primary develop language.
Now I have an application written in MFC.
When I first built it, it gives me those error.
error LNK2001: unresolved external symbol "public: long __thiscall CWnd::SendMessageW(unsigned int,unsigned int,long)" (?SendMessageW#CWnd##QAEJIIJ#Z) DbeCok.lib
Could someone give me a clue to fix this?
EDIT
The original message is below
Error 5 error LNK2001: unresolved external symbol "int __stdcall AfxDeactivateActCtx(unsigned long,unsigned long)" (?AfxDeactivateActCtx##YGHKK#Z) C:\WebDev\SPC\DbeCok.lib(GridCellBase.obj)
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 do have a program that works and compiles my dll perfectly in 32bits / Windows 7 but fails to generate the dll for 64 bits. All code regeneration is separated in different folders. Also, there is no libraries that I have developed myself that are required to link to this program that are mixed. The ones related to Windows itself seems to be different too.
Any suggestion of what is the cause of this problem ?
The output results is below.
Regards..
1> Creating library D:\Lib\LepComDll\x64\Release\LEPCOM.lib and object D:\Lib\LepComDll\x64\Release\LEPCOM.exp
1>LEPCOM.exp : error LNK2001: unresolved external symbol "int __stdcall LepComClose(void)" (?LepComClose##YGHXZ)
1>LEPCOM.exp : error LNK2001: unresolved external symbol "void __stdcall LepComDebug(int)" (?LepComDebug##YGXH#Z)
1>LEPCOM.exp : error LNK2001: unresolved external symbol "void __stdcall LepComDumpRx(void)" (?LepComDumpRx##YGXXZ)
1>LEPCOM.exp : error LNK2001: unresolved external symbol "int __stdcall LepComGet1Wire(int,int,char *)" (?LepComGet1Wire##YGHHHPAD#Z)
1>LEPCOM.exp : error LNK2001: unresolved external symbol "int __stdcall LepComGetAccel(int)" (?LepComGetAccel##YGHH#Z)
1>LEPCOM.exp : error LNK2001: unresolved external symbol "double __stdcall LepComGetDLLVersion(void)" (?LepComGetDLLVersion##YGNXZ)
1>LEPCOM.exp : error LNK2001: unresolved external symbol "int __stdcall LepComGetIds(class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > *)" (?LepComGetIds##YGHPAV?$CStringT#DV?$StrTraitMFC_DLL#DV?$ChTraitsCRT#D#ATL#####ATL###Z)
I just fix the problem. I have removed the .def file and asked the compiler to generate the code and worked. It seems the .def is only required for the 32 bits version.
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.
Basically, what's happening is this: I have a VC6 workspace (contains 3 projects total), and after NOT being able to succesfully port it into VS2010, I installed XP on a virtual machine (Win 7 on host machine), and installed VS6 on the devbox.
From there, I was able to get past compilation errors, and land headfirst into a whole slew of linker errors...
and I have no idea what's wrong. If anyone could help me with this it would be tremendously appreciated!
(an excert from the build log, there's 41 linker errors total...)
>Linking...
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall ReportMenuBuilder::~ReportMenuBuilder(void)" (??1ReportMenuBuilder##UAE#XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall ReportMenuBuilder::ReportMenuBuilder(void)" (??0ReportMenuBuilder##QAE#XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: bool __thiscall ReportMenuBuilder::Build(bool)" (?Build#ReportMenuBuilder##QAE_N_N#Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall CReportMultiDocTemplate::GetDocumentCount(void)const " (?GetDocumentCount#CReportMultiDocTemplate##QBEHXZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: class CString __thiscall ReportMenuBuilder::GetFilespecGivenID(unsigned int)const " (?GetFilespecGivenID#ReportMenuBuilder##QBE?AVCString##I#Z)
Only thing I can think of is apparently the projects are having trouble seeing the necessary files from the other projects, but I don't know why.
My first guess would be you haven't added the .lib file to the additional imports of the other projects. If you have dumpbin the binaries and see if you see the export.
I download Neoncube downloader and tried to compile. After I resolved some linking issues, there's still three that I can't solve.
1>main.obj : error LNK2019: unresolved
external symbol _UnEmbedBrowserObject
referenced in function "long stdcall
NoticeWindowProcedure(struct HWND
*,unsigned int,unsigned int,long)" (?NoticeWindowProcedure##YGJPAUHWND__##IIJ#Z)
1>main.obj : error LNK2019: unresolved
external symbol _EmbedBrowserObject
referenced in function "long stdcall
NoticeWindowProcedure(struct HWND
*,unsigned int,unsigned int,long)" (?NoticeWindowProcedure##YGJPAUHWND__##IIJ#Z)
1>main.obj : error LNK2019: unresolved
external symbol _DisplayHTMLPage
referenced in function "void cdecl
drawNotice(struct HWND *,int)"
(?drawNotice##YAXPAUHWND__##H#Z)
These functions appear to be from some obscure COM object from Microsoft. Yet I can't found any documentation on it. (UnEmbedBrowserObject, EmbedBrowserObject, DisplayHTMLPage)
Can someone help me?
Thanks
These are not names in any of the Microsoft SDK libraries. The appear to come from this code project. It could also be this one. You'll have to build it to create the DLL and add the .lib it produces to your project's linker input.