Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linker errors

Posted on 2000-05-02
5
Medium Priority
?
591 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 20 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

604 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