Linker error: unresolved external symbol __afxForceEXCLUDE

G

Guest

I have VC.NET 2003 C++ project and I've got a few hundred errors like that
and have no clue what might cause it:

error LNK2001: unresolved external symbol __afxForceEXCLUDE

Can anyone explain what might cause that linker error?

Thanks
 
S

Severian [MVP]

I have VC.NET 2003 C++ project and I've got a few hundred errors like that
and have no clue what might cause it:

error LNK2001: unresolved external symbol __afxForceEXCLUDE

Can anyone explain what might cause that linker error?

The library that defines the symbols you need is not included or not
available. From a quick search through the atl/mfc libraries, that
symbol is referenced or defined in these libraries:

eafxis.lib
eafxisd.lib
nafxcw.lib
nafxcwd.lib
uafxcw.lib
uafxcwd.lib

It's also referenced or defined in these, but I doubt they define it:

mfcs71.lib
mfcs71d.lib
mfcs71u.lib
mfcs71ud.lib

It may also be due to a missing -D switch to the compiler; perhaps
someone else knows which library actually defines it or which compiler
switch is necessary.
 
G

Guest

The libraries you mentioned are all default libraries which must be found by
linker according to project parameters. I have static link to MFC and Unicode
so as far as I understand linker must include uafxcwd.lib library
automatically by default.

Am I wrong?

Thanks
 
S

Severian [MVP]

The libraries you mentioned are all default libraries which must be found by
linker according to project parameters. I have static link to MFC and Unicode
so as far as I understand linker must include uafxcwd.lib library
automatically by default.

Am I wrong?

Probably not, but it sounds like something is interfering with that.
In Project Properties, go to the Link - Command Line pane and copy it,
then post your command line here. I'll see if I can figure out
anything.
 
G

Guest

Here are my compiler settings:

/Od /I "." /I ".." /I "..\id3lib\include" /D "WIN32" /D "_WINDOWS" /D
"_DEBUG" /D "ID3LIB_LINKOPTION=1" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /MTd
/GS /Gy /Zc:wchar_t /Yu"stdafx.h" /Fp".\debug/AppExample.pch" /Fo".\debug/"
/Fd".\debug/vc70.pdb" /W3 /nologo /c /Zi /TP

Here are my linker settings:

/OUT:".\debug/AppExample.exe" /INCREMENTAL /NOLOGO /NODEFAULTLIB
/DELAYLOAD:"gdiplus.dll" /DEBUG /PDB:".\debug/AppExample.pdb"
/SUBSYSTEM:WINDOWS /MACHINE:X86 version.lib winmm.lib ws2_32.lib gdiplus.lib
ADSIId.lib ..\zlib\debug\zlib.lib ..\crypto51\debug\cryptlib.lib
...\id3lib\libprj\id3libD.lib .\CxImage\debug\cximage.lib
...\ResizableLib\DebugUnicode\ResizableLib.lib DelayImp.lib DelayImp.lib

Here is linker output segment:

------ Build started: Project: AppExample, Configuration: Debug Win32 ------

Linking...
ResizableLib.lib(ResizableState.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
ResizableLib.lib(ResizableMinMax.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
ResizableLib.lib(ResizableGrip.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
ResizableLib.lib(ResizableLayout.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
ResizableLib.lib(ResizablePage.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
ResizableLib.lib(ResizableSheet.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
ResizableLib.lib(ResizableFormView.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
IrcChannelTabCtrl.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
IrcNickListCtrl.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
IrcWnd.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
ResizableLib.lib(ResizableDialog.obj) : error LNK2001: unresolved external
symbol __afxForceEXCLUDE
MuleSystrayDlg.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
TrayDialog.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
TrayMenuBtn.obj : error LNK2001: unresolved external symbol __afxForceEXCLUDE
IrcChannelListCtrl.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
ServerListCtrl.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
SharedFilesCtrl.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
UploadListCtrl.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE
GradientStatic.obj : error LNK2001: unresolved external symbol
__afxForceEXCLUDE

etc ....

Thanks
 
S

Severian [MVP]

Here are my compiler settings:

/Od /I "." /I ".." /I "..\id3lib\include" /D "WIN32" /D "_WINDOWS" /D
"_DEBUG" /D "ID3LIB_LINKOPTION=1" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /MTd
/GS /Gy /Zc:wchar_t /Yu"stdafx.h" /Fp".\debug/AppExample.pch" /Fo".\debug/"
/Fd".\debug/vc70.pdb" /W3 /nologo /c /Zi /TP

Here are my linker settings:

/OUT:".\debug/AppExample.exe" /INCREMENTAL /NOLOGO /NODEFAULTLIB
/DELAYLOAD:"gdiplus.dll" /DEBUG /PDB:".\debug/AppExample.pdb"
/SUBSYSTEM:WINDOWS /MACHINE:X86 version.lib winmm.lib ws2_32.lib gdiplus.lib
ADSIId.lib ..\zlib\debug\zlib.lib ..\crypto51\debug\cryptlib.lib
..\id3lib\libprj\id3libD.lib .\CxImage\debug\cximage.lib
..\ResizableLib\DebugUnicode\ResizableLib.lib DelayImp.lib DelayImp.lib

/NODEFAULTLIB is telling the linker to ignore default libraries. Try
removing this option, or explicitly specify the system libraries you
need.

It's possible that you added this to eliminate some other linker error
because of conflicting needs of linked libraries. Instead of
/NODEFAULTLIB, you can specify /NODEFAULTLIB:libname to exclude a
specific default library (such as a conflict between LIBMT and
LIBMTD).
 
G

Guest

Thank you very much for your help.

Severian said:
/NODEFAULTLIB is telling the linker to ignore default libraries. Try
removing this option, or explicitly specify the system libraries you
need.

It's possible that you added this to eliminate some other linker error
because of conflicting needs of linked libraries. Instead of
/NODEFAULTLIB, you can specify /NODEFAULTLIB:libname to exclude a
specific default library (such as a conflict between LIBMT and
LIBMTD).
 
G

Guest

Thank you very much for your help!

Severian said:
/NODEFAULTLIB is telling the linker to ignore default libraries. Try
removing this option, or explicitly specify the system libraries you
need.

It's possible that you added this to eliminate some other linker error
because of conflicting needs of linked libraries. Instead of
/NODEFAULTLIB, you can specify /NODEFAULTLIB:libname to exclude a
specific default library (such as a conflict between LIBMT and
LIBMTD).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top