473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Please help with STL

I'm trying to use STL maps with VC++ 6 .
I already have 2 different types of maps working fine,
but a new one that I've just added refuses to work
Instead of some reasonable explanation the compiler gives
me the following mumble-jumble:

Dungeon.obj : error LNK2005: "class std::map<unsigned short,int,struct
std::less<unsigned short>,class std::allocator<int> > siMap"
(?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already defined
in Digger.obj
DungOperations.obj : error LNK2005: "class std::map<unsigned
short,int,struct std::less<unsigned short>,class std::allocator<int> >
siMap" (?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already
defined in Digger.obj
Fov.obj : error LNK2005: "class std::map<unsigned short,int,struct
std::less<unsigned short>,class std::allocator<int> > siMap"
(?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already defined
in Digger.obj
Game.obj : error LNK2005: "class std::map<unsigned short,int,struct
std::less<unsigned short>,class std::allocator<int> > siMap"
(?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already defined
in Digger.obj
Global.obj : error LNK2005: "class std::map<unsigned short,int,struct
std::less<unsigned short>,class std::allocator<int> > siMap"
(?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already defined
in Digger.obj
IO.obj : error LNK2005: "class std::map<unsigned short,int,struct
std::less<unsigned short>,class std::allocator<int> > siMap"
(?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already defined
in Digger.obj
Debug/game.exe : fatal error LNK1169: one or more multiply defined symbols
found
Error executing link.exe.

I have no idea how to fix this or interpret it and I do not
want to replace the map with a usual array unless it's
completely necessary. Can anyone help me?
Jul 19 '05 #1
1 2690
Kostatus wrote:
I'm trying to use STL maps with VC++ 6 .
I already have 2 different types of maps working fine,
but a new one that I've just added refuses to work
Instead of some reasonable explanation the compiler gives
me the following mumble-jumble:
...
Dungeon.obj : error LNK2005: "class std::map<unsigned short,int,struct
std::less<unsigned short>,class std::allocator<int> > siMap"
(?siMap@@3V?$map@GHU?$less@G@std@@V?$allocator@H@2 @@std@@A) already defined
in Digger.obj
...
I have no idea how to fix this or interpret it and I do not
want to replace the map with a usual array unless it's
completely necessary. Can anyone help me?
...


You have more than one definition for object 'siMap' in your program,
which is a violation of ODR (One Definition Rule). Most common reason
for this error is putting an object definition into header file and then
including this header file in multiple translation units.

Did you put the definition of 'siMap' into a header file? If so, move it
to some implementation file instead, leaving only a non-defining
_declaration_ of this object in the header file.

For example, header file should contain something like this

extern std::map<unsigned short, int> siMap;

and one (and only one of implementation files) should contain something
like this

std::map<unsigned short, int> siMap;

--
Best regards,
Andrey Tarasevich
Brainbench C and C++ Programming MVP

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: HolaGoogle | last post by:
Hi all, Please help me with the following..it's realy urgent and i tried everything i could and i can't get it work properly!! Thanks in advance. Here's what i'm trying to accomplish: in my...
2
by: rked | last post by:
I get nameSPAN1 is undefined when I place cursor in comments box.. <%@ LANGUAGE="VBScript" %> <% DIM ipAddress ipAddress=Request.Servervariables("REMOTE_HOST") %> <html> <head> <meta...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
3
by: Mark Broadbent | last post by:
could somebody please recommend a good book to prepare for exam Exam 70-320*: Developing XML Web Services and Server Components with Microsoft Visual C# and the Microsoft .NET Framework . One that...
13
by: Joner | last post by:
Hello, I'm having trouble with a little programme of mine where I connect to an access database. It seems to connect fine, and disconnect fine, but then after it won't reconnect, I get the error...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.