Connect with Expertise | Find Experts, Get Answers, Share Insights

Static MFC in DLL (linker error)

ac2806
 
Posts: n/a
#1: Nov 17 '05
Hi
I want to use the static MFC within a dll, but I get the following errors
when linking:
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv

nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc

nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol
__mbctype

nafxcwd.lib(viewedit.obj) : error LNK2019: unresolved external symbol
__mbctype referenced in function "protected: long __thiscall
CEditView::OnFindReplaceCmd(unsigned int,long)"
(?OnFindReplaceCmd@CEditView@@IAEJIJ@Z)

When I specifiy _AFXDLL in the preprocessor settings the project compiles
correctly, but on program execution, the MFC71D.dll is still required, as
when using the shared dll mfc.

I tried to solve the problem by using /NODEFAULTLIB: nafxcwd.lib (as it was
described in an previous thread), but then I even get more errors.

Does somebody have an idea?

thanks
Alex



Kyle Alons
 
Posts: n/a
#2: Nov 17 '05

re: Static MFC in DLL (linker error)


http://support.microsoft.com/default...;EN-US;Q148652

--
---------------------------------------------------
Automate your software builds with Visual Build Pro
http://www.visualbuild.com/

"ac2806" <ac2806@onemail.at> wrote in message
news:43021314$0$8412$79720d31@newsreader.inode.at. ..[color=blue]
> Hi
> I want to use the static MFC within a dll, but I get the following errors
> when linking:
> nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol
> ___argv
>
> nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol
> ___argc
>
> nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol
> __mbctype
>
> nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol
> __mbctype
>
> nafxcwd.lib(viewedit.obj) : error LNK2019: unresolved external symbol
> __mbctype referenced in function "protected: long __thiscall
> CEditView::OnFindReplaceCmd(unsigned int,long)"
> (?OnFindReplaceCmd@CEditView@@IAEJIJ@Z)
>
> When I specifiy _AFXDLL in the preprocessor settings the project compiles
> correctly, but on program execution, the MFC71D.dll is still required, as
> when using the shared dll mfc.
>
> I tried to solve the problem by using /NODEFAULTLIB: nafxcwd.lib (as it
> was described in an previous thread), but then I even get more errors.
>
> Does somebody have an idea?
>
> thanks
> Alex
>
>[/color]


ac2806
 
Posts: n/a
#3: Nov 17 '05

re: Static MFC in DLL (linker error)


Thanks for the link, but as I wrote before, when I try to ignore the lib
(nafxcwd.lib) by specifying it in "Properties/Linker/Input/Ignore Specific
Libraries", it get even more linker errors.
I also tried to add msvcrtd.lib but this also didn't help.

Any futher suggestions?


"Kyle Alons" <reply@to.newsgroup> wrote in message
news:u$ubWjqoFHA.2156@TK2MSFTNGP09.phx.gbl...[color=blue]
> http://support.microsoft.com/default...;EN-US;Q148652
>
> --
> ---------------------------------------------------
> Automate your software builds with Visual Build Pro
> http://www.visualbuild.com/
>
> "ac2806" <ac2806@onemail.at> wrote in message
> news:43021314$0$8412$79720d31@newsreader.inode.at. ..[color=green]
>> Hi
>> I want to use the static MFC within a dll, but I get the following errors
>> when linking:
>> nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol
>> ___argv
>>
>> nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol
>> ___argc
>>
>> nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol
>> __mbctype
>>
>> nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol
>> __mbctype
>>
>> nafxcwd.lib(viewedit.obj) : error LNK2019: unresolved external symbol
>> __mbctype referenced in function "protected: long __thiscall
>> CEditView::OnFindReplaceCmd(unsigned int,long)"
>> (?OnFindReplaceCmd@CEditView@@IAEJIJ@Z)
>>
>> When I specifiy _AFXDLL in the preprocessor settings the project compiles
>> correctly, but on program execution, the MFC71D.dll is still required, as
>> when using the shared dll mfc.
>>
>> I tried to solve the problem by using /NODEFAULTLIB: nafxcwd.lib (as it
>> was described in an previous thread), but then I even get more errors.
>>
>> Does somebody have an idea?
>>
>> thanks
>> Alex
>>
>>[/color]
>
>[/color]


Arvind Kumar
 
Posts: n/a
#4: Mar 10 '06

re: Static MFC in DLL (linker error)


Change In "Configration property "->"C/C++"->"Code Generation"->"RunTime
Library" to Multi-threaded (/MT)

Hope it will solve your problem
Closed Thread