Solved

Linker errors

Posted on 2000-05-02
5
566 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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now