Game Development Community

Compile error: LNK2005 ... already defined

by Scott Fortner · in Torque Game Engine · 12/03/2003 (12:33 pm) · 7 replies

I am using VC7 (VS.NET 2002 not VS.NET 2003, therefore I am using the source from the VC6 folder). I followed the instructions in the "TGE Tutorial 1: Getting Started" from www.wazooenterprises.com. I had a lot of link errors that I was able to resolve, but I have a few that I am not sure how to proceed on. Here they are:

TGEProto1 error LNK2005: _processTriFan already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanSP already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanVC_TF already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanSP_FC already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanFC_VB already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanSP_FC_VB already defined in itfdump.obj
TGEProto1 error LNK2005: __dosmaperr already defined in LIBCD.lib(dosmap.obj)
TGEProto1 error LNK2005: __getmbcp already defined in LIBCD.lib(mbctype.obj)
TGEProto1 error LNK2005: __setmbcp already defined in LIBCD.lib(mbctype.obj)
TGEProto1 error LNK2005: ___initmbctable already defined in LIBCD.lib(mbctype.obj)

Any and all help is appreciated. Thanks.

#1
12/03/2003 (12:39 pm)
Scott,

It seems that you have functions in your code that are implemented twice (most likely)...

Try finding these functions and seeing where they are duplicated, and remove the conflicting files (if possible).
#2
12/03/2003 (1:56 pm)
Just for clarification, I am trying to compile the Torque engine, I left that out in the first post.
#3
12/03/2003 (2:41 pm)
Strange. I suspect you're somehow compiling more than you need to.
#4
12/03/2003 (7:40 pm)
Did you solve this? If not, I had the same problem compiling with VS .NET 2002. The answer to your problem is to have the Linker ignore the LIBCD.lib. To do this you can right-click over the offending project and select properties from the menu. Then, make sure the configuration (Debug or Active) you want to modify is selected and select Configuration->Linker->Input.
Beside'Ignore Specific Library' type LIBCD.lib.

This should work.
#5
12/03/2003 (10:03 pm)
Thanks Robert, that got rid of half of the 2005 errors, now I just have these:

TGEProto1 error LNK2005: _processTriFan already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanSP already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanVC_TF already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanSP_FC already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanFC_VB already defined in itfdump.obj
TGEProto1 error LNK2005: _processTriFanSP_FC_VB already defined in itfdump.obj

The only place that I can find these functions are in the file itfdump.asm and it seems like they are ifdef'd for LINUX which I am not using, so I don't see why they would be a problem.
#6
12/03/2003 (11:06 pm)
You sure they're not being compiled? Put an error in there and see if you break something. :)
#7
12/04/2003 (2:45 pm)
Always more than one way to skin a cat. I took a different approach, instead of following that tutorial, I just opened up the Torque Demo vcproject and modified it. After a few adjustments it fully compiles. Thanks to all for the tips.