Linker Errors (Again)

Started by
12 comments, last by Fuzztrek 21 years, 2 months ago
Hello, I have 7 linker errors:
  
Sirius Engine v2.0 error LNK2001: unresolved external symbol ___argc
Sirius Engine v2.0 error LNK2001: unresolved external symbol ___argv
Sirius Engine v2.0 error LNK2001: unresolved external symbol __mbctype
Sirius Engine v2.0 error LNK2005: "public: __thiscall CFont::CFont(void)" (??0CFont@@QAE@XZ) already defined in Visual.obj
Sirius Engine v2.0 error LNK2005: "public: virtual __thiscall CFont::~CFont(void)" (??1CFont@@UAE@XZ) already defined in Visual.obj
Sirius Engine v2.0 error LNK2019: unresolved external symbol "long __cdecl DXUtil_FindMediaFileCb(char *,int,char *)" (?DXUtil_FindMediaFileCb@@YAJPADH0@Z) referenced in function "public: virtual long __stdcall CAllocateHierarchy::CreateMeshContainer(char const *,struct _D3DXMESHDATA *,struct _D3DXMATERIAL *,struct _D3DXEFFECTINSTANCE *,unsigned long,unsigned long *,struct ID3DXSkinInfo *,struct _D3DXMESHCONTAINER * *)" (?CreateMeshContainer@CAllocateHierarchy@@UAGJPBDPAU_D3DXMESHDATA@@PAU_D3DXMATERIAL@@PAU_D3DXEFFECTINSTANCE@@KPAKPAUID3DXSkinInfo@@PAPAU_D3DXMESHCONTAINER@@@Z)
Sirius Engine v2.0 error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z)
  
Um.. what are they and what do they want from me? :| I swear.. I am so clueless when it comes to linker errors. I know the basic "unresolved external symbol main", but other than that.. Thanks (so much!) in advance. Fuzztrek
Advertisement
what compiler are you using on what ide?
Oh, sorry. MSVC++ (7.0).
For some reason, the compiler isn''t seeing the definitions of some of your functions/parameters. Make sure all the C++ files are properly included in the project.

Also, for the multiply-defined symbols, you can probably fix those with inclusions guards. I''d probably need to see the whole code/project-sheebang to give any more detailed suggestions.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

4th and 5th: define ctor and dtor for cfont in a source file, not in a header, or make them inline.

6th: you have copied over the new dxutil.h, but not dxutil.cpp. replace your copy of dxutil.cpp with the one from dx9sdk.

7th: go over project settings for the entire project and for every source file that's in it, and make sure under general tab you are "using standard windows libraries" for mfc use.

first three: go over project settings as i said, making sure that "runtime library" option under c/c++-code generation is the same for all files.

after making any changes, make sure you do "rebuild all", not just build.

you may need to do this for all configurations, not just for the current one.

[edited by - niyaw on January 28, 2003 12:38:00 AM]
quote:Original post by ZealousElixir
For some reason, the compiler isn''t seeing the definitions of some of your functions/parameters.

not his functions; those are functions defined by the c runtime and found in libc/libcmt/msvcrt.lib and their debug versions. the problem is that some source files want to use crt in a dll, and that''s project default; these files reference symbols such as above as __imp____argc instead of ___argc (give or take an underscore). some other files are compiled to statically link to crt, and use ___argc version. at link time, msvcrt.lib or msvcrtd.lib is provided, which defines __imp___argc but not ___argc. same for ___argv and __mbctype.
quote:
Also, for the multiply-defined symbols, you can probably fix those with inclusions guards.

that will never help. inclusion guards only prevent compile-time errors, namely, redefinitions when a declaration or definition is included twice in the same source file. here, the problem is that two different source files define the same symbol, and include guards are of no use.
quote:
I''d probably need to see the whole code/project-sheebang to give any more detailed suggestions.


Thanks everyone for your help!

I went though all of the file settings, however nothing was out of line. When I rebuilt everything, a few linker errors had left :D. However, I still have the following:


  Sirius Engine v2.0 error LNK2001: unresolved external symbol ___argcSirius Engine v2.0 error LNK2001: unresolved external symbol ___argvSirius Engine v2.0 error LNK2001: unresolved external symbol __mbctypeSirius Engine v2.0 error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z)   


For the release settings, I have the runtime library as Multi-threaded DLL, and for the debug settings I have the runtime library as Multi-threaded Debug DLL. I think this is what it should be as.. am I right? Or does it ahve anything to do with the current problem?

Thanks again for all your help!!

Fuzztrek

¬_¬

[edited by - Fuzztrek on January 29, 2003 1:28:20 PM]
Who''s bad? niyaw''s bad! Seriously, thanks for showing me up with your knowledge of VC and making me look stupid. Seriously. We all need some humbling every once a while. I unfortunately get humbled very often...

quote:Original post by niyaw
not his functions; those are functions defined by the c runtime and found in libc/libcmt/msvcrt.lib and their debug versions. the problem is that some source files want to use crt in a dll, and that''s project default; these files reference symbols such as above as __imp____argc instead of ___argc (give or take an underscore). some other files are compiled to statically link to crt, and use ___argc version. at link time, msvcrt.lib or msvcrtd.lib is provided, which defines __imp___argc but not ___argc. same for ___argv and __mbctype.


Well, I was mostly referring to the DX function, which I figured meant he didn''t including the right SDK file. I didn''t know about the different release/debug parameters though, so thanks for the info.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

Fuzztrek: post complete error messages (including obj/lib file names that break).

ZE: you''re right, sorry about that. won''t happen again.
oh, sorry. I keep forgetting that output != task list


  nafxcw.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctypenafxcw.lib(filelist.obj) : error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z)nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argvnafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argcRelease/Sirius Engine v2.0.exe : fatal error LNK1120: 3 unresolved externals  

This topic is closed to new replies.

Advertisement