I have a custom QVector class, which has a single function: to return the element of the vector fulfilling some conditions.
Here is some code: customvector.h
#ifndef CUSTOMVECTOR_H
#define CUSTOMVECTOR_H
#include "customfile.h"
#include <QVector>
template<typename T>
class CustomVector : public QVector<T>
{
public:
using QVector<T>::QVector;
CustomFile find(int index);
};
customvector.cpp
#include "customvector.h"
template <typename T>
CustomFile CustomVector<T>::find(int index)
{
// Processing
}
#endif // CUSTOMVECTOR_H
The code driving this:
CustomVector<CustomFile> files;
files[0] = CustomFile(0);
files[1] = CustomFile(1);
qDebug() << files.get(0).index;
customfile.h
class CustomFile
{
public:
CustomFile(int index);
int index;
};
customfile.cpp
CustomFile::CustomFile(int index)
{
this->index = index;
};
The issue I am having is that I keep getting a LNK2019 error, telling me that the find(int) function is an unresolved external symbol. Can anyone help?