Solved

Linker errors

Posted on 2000-05-02
5
570 Views
Last Modified: 2008-03-17
WHY would it even say this each file gets included once!(except standard headers like stdio.h) and it gives me this!!

Linking...
network.obj : error LNK2005: "int __cdecl startandlisten(void)" (?startandlisten@@YAHXZ) already defined in M_D.obj
network.obj : error LNK2005: "unsigned int *  usersonline" (?usersonline@@3PAIA) already defined in M_D.obj
network.obj : error LNK2005: "unsigned int  temp" (?temp@@3IA) already defined in M_D.obj
network.obj : error LNK2005: "unsigned int  connection" (?connection@@3IA) already defined in M_D.obj
area.obj : error LNK2005: "int __cdecl getareas(void)" (?getareas@@YAHXZ) already defined in M_D.obj
area.obj : error LNK2005: "int __cdecl readareadata(char const * const)" (?readareadata@@YAHQBD@Z) already defined in M_D.obj
area.obj : error LNK2005: "int *  objvnums" (?objvnums@@3PAHA) already defined in M_D.obj
area.obj : error LNK2005: "int (*  npcat)[32767]" (?npcat@@3PAY0HPPP@HA) already defined in M_D.obj
area.obj : error LNK2005: "char (*  objdescript)[1024]" (?objdescript@@3PAY0EAA@DA) already defined in M_D.obj
area.obj : error LNK2005: "char (*  npcdescript)[1024]" (?npcdescript@@3PAY0EAA@DA) already defined in M_D.obj
area.obj : error LNK2005: "char (*  objname)[50]" (?objname@@3PAY0DC@DA) already defined in M_D.obj
area.obj : error LNK2005: "int  numarefiles" (?numarefiles@@3HA) already defined in M_D.obj
area.obj : error LNK2005: "char (*  npcname)[50]" (?npcname@@3PAY0DC@DA) already defined in M_D.obj
area.obj : error LNK2005: "char *  filenam" (?filenam@@3PADA) already defined in M_D.obj
area.obj : error LNK2005: "int *  npcsvnums" (?npcsvnums@@3PAHA) already defined in M_D.obj
area.obj : error LNK2005: "int (*  doors)[4]" (?doors@@3PAY03HA) already defined in M_D.obj
area.obj : error LNK2005: "char (*  title)[50]" (?title@@3PAY0DC@DA) already defined in M_D.obj
area.obj : error LNK2005: "int (*  objat)[32767]" (?objat@@3PAY0HPPP@HA) already defined in M_D.obj
area.obj : error LNK2005: "struct _iobuf *  areafile" (?areafile@@3PAU_iobuf@@A) already defined in M_D.obj
area.obj : error LNK2005: "int *  vnum" (?vnum@@3PAHA) already defined in M_D.obj
area.obj : error LNK2005: "char (*  descript)[1024]" (?descript@@3PAY0EAA@DA) already defined in M_D.obj
Release/M_D.exe : fatal error LNK1169: one or more multiply defined symbols found

LIKE sure how! dumb linker ;)
Help greatly appreciated i can send the source to it if you give your email its too long to post here though
0
Comment
Question by:beyonddeath
  • 3
  • 2
5 Comments
 

Author Comment

by:beyonddeath
ID: 2771206
oh and this stuff shouldnt be getting redefined in these obj files (its only including everything 1 time!)
0
 

Accepted Solution

by:
sklose earned 5 total points
ID: 2771410
This occurs when you
#include a .cpp file ie
#include "file.cpp" instead of
#include "file.h"

Have a check for this in your code. Let me know how you go.
0
 

Expert Comment

by:sklose
ID: 2771450
Also if the #include thing is not applicable have a look at

http://support.microsoft.com/support/kb/articles/q148/6/52.asp

It discusses the error LNK2005 in more detail than I can explain here.

If you are still having trouble email me the source code.

Cheers

sklose@csc.com.au

 
0
 

Author Comment

by:beyonddeath
ID: 2772911
ok but if i include the h files i cant get it to compile cause all my variables go down the drain for some reason (even though i set the h files to include the cpp files) its really annoying....

Ill look into it later its too early now ;) (7am)
0
 

Author Comment

by:beyonddeath
ID: 2773053
Thanks allot i figured it out it was compiling everything twice cause it was in the source files thing in the workspace and included (my bad im not used to vc++ used to gcc)

Thanks allot
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question