• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Inserting into a set

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
mudface061200
Asked:
mudface061200
1 Solution
 
Chase707Commented:
What is the exact linker error that you are getting?

Chase707
0
 
Jan LouwerensSoftware EngineerCommented:
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
 
Jan LouwerensSoftware EngineerCommented:
try creating an operator= function and a copy constructor for the My_Data class
0
 
MDarlingCommented:
Is My_DataSet actually declared in a file in your project?

Your example simply shows it as declared somewhere externally.

0
 
mudface061200Author Commented:
It was actually a compiler issue, this was the first legitimate answer.  Thanks to all who made suggestions.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now