Reputation: 3190
I am trying to create a QList
of custom objects, but am unable to do so. The compilation error I receive when trying to do so is:
error: symbol(s) not found for architecture x86_64 (file not found)
I am able to create a QList
of pointers of custom objects, as well as that of primitive data types. I know QList
supports doing what I am trying to do, as it says so in the documentation.
I am using Mac OS X 10.7.5, Qt 5.0.1, and Qt Creator 2.6.2.
Code:
QList<MyClass> my_list;
Upvotes: 2
Views: 5228
Reputation: 2259
According to the documentation: QList's value type must be an assignable data type.
To qualify, a type must provide a default constructor, a copy constructor, and an assignment operator. So your custom class should be implemented like this.
class MyClass
{
public:
MyClass() {}
MyClass(const MyClass &other);
MyClass &operator=(const MyClass &other);
private:
//private data members
};
Upvotes: 12