Solved

Inserting into a set

Posted on 2002-06-19
5
222 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

929 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

8 Experts available now in Live!

Get 1:1 Help Now