I want to link a project of mine, developed in VC++, using MFC, by
statically linking the MFC libraries, so as the executable to run on a PC
without MSVC installed. Although all this time, this has caused me no
problem at all, and it linked successfully, when I tried to do it yesterday,
I got the following linker errors :
nafxcw.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator
new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcrt.lib(MSVCRT.dll);
second definition ignored
nafxcw.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void
*)" (??3@YAXPAX@Z) already defined in msvcrt.lib(MSVCRT.dll); second
definition ignored
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
nafxcw.lib(apphelp.obj) : error LNK2001: unresolved external symbol
__mbctype
nafxcw.lib(filelist.obj) : error LNK2001: unresolved external symbol
__mbctype
nafxcw.lib(timecore.obj) : error LNK2001: unresolved external symbol
__mbctype
I could find no help on those, and I tried to change the order of the
library paths, setting the MSVC paths first, but nothing changed. When I use
MFC libraries in a shared DLL the project links successfully... And this
happens with both Release and Debug versions.
I explicitly exclude "libc.lib" and "libcmt.lib" with the /nodefaultlib
directive, as instructed, because I get unresolved externals and conflicts.
The calling convention I use in the C/C++ tab of the project settings is
stdcall, and I have to use this, as cdecl causes problem with the libraries
I use...
What could be wrong and I get these error messages?
Any hint would be greatly appreciated,
Thank you in advance,
Regards,
Nikos
Try adding msvcrt.lib to the "Ignore libraries:" section in
Project|Settings|Link|Output
John.
Actually that's probably not the answer, it looks like nafxcw.lib is linking
to the dll, you'll have to check how nafxcw.lib is linking and try to fix
that.
Thank you for the reply...
> Actually that's probably not the answer, it looks like nafxcw.lib is
linking
> to the dll, you'll have to check how nafxcw.lib is linking and try to fix
> that.
Erm... how am I supposed to do that? And why has it not caused me problems
earlier? What could be different? Actually, I had no knowledge of this
particular library. I suppose it is one of the basic MFC libraries...
Thank you for the help,
Regards,
Nikos
http://support.microsoft.com/support/kb/articles/q148/6/52.asp
John
"Nikos Karelos" <nkar...@profile.gr> wrote in message
news:uxld55KeBHA.1432@tkmsftngp04...
Jeff
"Nikos Karelos" <nkar...@profile.gr> wrote in message
news:uxld55KeBHA.1432@tkmsftngp04...
The problem is solved, and as it seems it was due to ignoring the wrong
default libraries, in combination with "testing" the include paths order.
Best Regards,
Nikos