#### Archived

This topic is now archived and is closed to further replies.

This topic is 5434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
what compiler are you using on what ide?

##### Share on other sites
Oh, sorry. MSVC++ (7.0).

##### Share on other sites
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.//

##### Share on other sites
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]

##### Share on other sites
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.

##### Share on other sites

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]

##### Share on other sites
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.//

##### Share on other sites
Fuzztrek: post complete error messages (including obj/lib file names that break).

ZE: you''re right, sorry about that. won''t happen again.

##### Share on other sites
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

##### Share on other sites
This is just a guess, but with the argc and argv errors:
Do you have: int main() and use argc and argv somewhere?
Try using: int main(int argc, char **argv)

This is really just a guess though....

______________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________

##### Share on other sites
Actually, I''m programming in windows. Even so, I doubt that would have been the problem. Thanks though!

##### Share on other sites
as i said, you''re linking with mfc libs.

make absolutely sure that "use of mfc" option is set to "use standard windows libraries", that you aren''t including any headers whose names start with afx, and that you aren''t linking with libs whose names start with nafx.

##### Share on other sites
Ah, turns out I was including afx.h.

[edited by - Fuzztrek on January 29, 2003 11:57:04 PM]

• ### Forum Statistics

• Total Topics
628714
• Total Posts
2984350

• 23
• 11
• 10
• 13
• 14