PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VC .NET
Linker error __argv, __argc, __mbctype
Forums
Newsgroups
Microsoft DotNet
Microsoft VC .NET
Linker error __argv, __argc, __mbctype
![]() |
Linker error __argv, __argc, __mbctype |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi All,
I'm getting the following linker error when I try to build a library. 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 LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z) 1) Use MFC in a shared DLL 2) Multi-Threaded DLL I'm using VC++ .NET 2003. It is compiling without any error in VC++ 6 (We are in the process of proting to .NET) Can any one help me in resolving the errors? -- Thanks much Saran |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Saran wrote:
>Hi All, > >I'm getting the following linker error when I try to build a library. > >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 LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z) > >1) Use MFC in a shared DLL >2) Multi-Threaded DLL > >I'm using VC++ .NET 2003. It is compiling without any error in VC++ 6 (We are in the process of proting to .NET) > >Can any one help me in resolving the errors? If you look inside <afx.h>, you'll find: #ifndef _AFXDLL #ifndef _UNICODE #ifdef _DEBUG #pragma comment(lib, "nafxcwd.lib") .... So it appears that for some reason, _AFXDLL is not #defined, so the static MFC library is selected. You should look at the preprocessor settings for your project and make sure this symbol is listed there. -- Doug Harrison Microsoft MVP - Visual C++ |
|
|
|
#3 |
|
Guest
Posts: n/a
|
> I'm getting the following linker error when I try to build a library.
> > 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 LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z) > > 1) Use MFC in a shared DLL > 2) Multi-Threaded DLL Q166504 perhaps? ben -- http://bschwehn.de |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Saran wrote:
>Hi Doug, > >I checked the project settings and it seems that it already got it from inherited value but when I built it, it didn't show up in the log. So I tried to add it to preprocessor definition for the project and still didn't show up in the log. Finally I added it to individual file setting to see it in the logfile but still got the same linker errors. > >Here is the log: > >/I ".." /I "../.." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MANAGERBASE_EXPORTS" /D "NOMINMAX" /D "PC_ANSOFT" /D "_AFXDLL" /FD /EHsc /MD /GR /Fp".\Release/managerbase.pch" /Fo".\Release/" /Fd".\Release/" /W3 /c >.\SolveSetupMgr.cpp >.\SolveSetupCmdInfo.cpp >.\SolveSetup.cpp >.\ManagerBase.cpp >] >Creating command line "cl.exe @c:\viewstore\hfdebug_net_porting\nextgen\lib\managerbase\source\Release\RSP0002F2.rsp /nologo" >Creating temporary file "c:\viewstore\hfdebug_net_porting\nextgen\lib\managerbase\source\Release\RSP0002F3.rsp" with contents >[ >/OUT:".\../../../Release/managerbase.dll" /INCREMENTAL:NO /NOLOGO /DLL /NODEFAULTLIB:"nafxcw.lib msvcrt.lib" /PDB:".\../../../Release/managerbase.pdb" /IMPLIB:".\../../../Release/managerbase.lib" /MACHINE:X86 nafxcw.lib msvcrt.lib \viewstore\hfdebug_net_porting\nextgen\Release\ngcore.lib >.\Release\ManagerBase.obj >.\Release\SolveSetup.obj >.\Release\SolveSetupCmdInfo.obj >.\Release\SolveSetupMgr.obj >] > >Actually I added nafxcw.lib msvcrt.lib to get rid of several linker errors. I also confirmed that ngcore.lib has _AFXDLL defined. Try getting rid of these parts of the linker command: /NODEFAULTLIB:"nafxcw.lib msvcrt.lib" nafxcw.lib msvcrt.lib If that doesn't help, see if the linker /VERBOSE switch sheds any light. -- Doug Harrison Microsoft MVP - Visual C++ |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Hi Doug,
Removing nafxcw.lib and adding msvrt.lib helped solve the problem. Thanks for your help. -- Thanks much Saran "Doug Harrison [MVP]" wrote: > Saran wrote: > > >Hi Doug, > > > >I checked the project settings and it seems that it already got it from inherited value but when I built it, it didn't show up in the log. So I tried to add it to preprocessor definition for the project and still didn't show up in the log. Finally I added it to individual file setting to see it in the logfile but still got the same linker errors. > > > >Here is the log: > > > >/I ".." /I "../.." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MANAGERBASE_EXPORTS" /D "NOMINMAX" /D "PC_ANSOFT" /D "_AFXDLL" /FD /EHsc /MD /GR /Fp".\Release/managerbase.pch" /Fo".\Release/" /Fd".\Release/" /W3 /c > >.\SolveSetupMgr.cpp > >.\SolveSetupCmdInfo.cpp > >.\SolveSetup.cpp > >.\ManagerBase.cpp > >] > >Creating command line "cl.exe @c:\viewstore\hfdebug_net_porting\nextgen\lib\managerbase\source\Release\RSP0002F2.rsp /nologo" > >Creating temporary file "c:\viewstore\hfdebug_net_porting\nextgen\lib\managerbase\source\Release\RSP0002F3.rsp" with contents > >[ > >/OUT:".\../../../Release/managerbase.dll" /INCREMENTAL:NO /NOLOGO /DLL /NODEFAULTLIB:"nafxcw.lib msvcrt.lib" /PDB:".\../../../Release/managerbase.pdb" /IMPLIB:".\../../../Release/managerbase.lib" /MACHINE:X86 nafxcw.lib msvcrt.lib \viewstore\hfdebug_net_porting\nextgen\Release\ngcore.lib > >.\Release\ManagerBase.obj > >.\Release\SolveSetup.obj > >.\Release\SolveSetupCmdInfo.obj > >.\Release\SolveSetupMgr.obj > >] > > > >Actually I added nafxcw.lib msvcrt.lib to get rid of several linker errors. I also confirmed that ngcore.lib has _AFXDLL defined. > > Try getting rid of these parts of the linker command: > > /NODEFAULTLIB:"nafxcw.lib msvcrt.lib" > nafxcw.lib msvcrt.lib > > If that doesn't help, see if the linker /VERBOSE switch sheds any light. > > -- > Doug Harrison > Microsoft MVP - Visual C++ > |
|
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

