Solved

Linker errors

Posted on 2000-05-02
5
577 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

739 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