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
Solved

Inserting into a set

Posted on 2002-06-19
5
225 Views
Last Modified: 2010-04-01
The following insert call produces a link error and I have no clue why.  Any suggestions?

extern set<My_Data> My_DataSet;

...

bool My_Data::AddRecord( char * trackingNumber, char * scanInfo )
{
     My_DataSet.insert(My_Data( trackingNumber, scanInfo ));//the link error is here
...
     return true;
}
0
Comment
Question by:mudface061200
5 Comments
 
LVL 4

Expert Comment

by:Chase707
ID: 7093984
What is the exact linker error that you are getting?

Chase707
0
 
LVL 5

Accepted Solution

by:
Jan Louwerens earned 100 total points
ID: 7094245
I'm guessing you don't have an operator= defined for your My_Data class. Since you are using an actual object rather than a pointer to an object (extern set<My_Data> My_DataSet;), when you stick an object into the set, the operator= function is used to copy the object (My_DataSet.insert(My_Data( trackingNumber, scanInfo ));)
0
 
LVL 5

Expert Comment

by:Jan Louwerens
ID: 7094247
try creating an operator= function and a copy constructor for the My_Data class
0
 
LVL 3

Expert Comment

by:MDarling
ID: 7095310
Is My_DataSet actually declared in a file in your project?

Your example simply shows it as declared somewhere externally.

0
 
LVL 1

Author Comment

by:mudface061200
ID: 7099516
It was actually a compiler issue, this was the first legitimate answer.  Thanks to all who made suggestions.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 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 how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

856 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