Solved

Linker errors

Posted on 2000-05-02
5
562 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

772 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

12 Experts available now in Live!

Get 1:1 Help Now