I may be missing something obvious, but I can't get rid of a linking error in my Qt user interface.
I've isolated the part that's causing trouble. Basically, I'm implementing a subclass of QGraphicsView
to display an interactive overhead map. For some reason, I can't get the constructor to be resolved.
OverheadMap.h :
#ifndef OVERHEADMAP_H
#define OVERHEADMAP_H
#include <QGraphicsView>
class OverheadMap : public QGraphicsView {
Q_OBJECT
public:
OverheadMap();
};
#endif // OVERHEADMAP_H
OverheadMap.cpp :
#include "OverheadMap.h"
OverheadMap::OverheadMap() {
// Body
}
main.cpp :
#include "OverheadMap.h"
int main(int argc, char *argv[])
{
OverheadMap *map = new OverheadMap();
}
LNK2019 :
main.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall OverheadMap::OverheadMap(void)" (??0OverheadMap@@QAE@XZ) referenced in function _main
I can without any trouble use QtCreator's auto-completion with OverheadMap
, and I have done a similar subclass implementation of a QFrame that's working, so I doubt there's a syntax error here.
What am I missing?
Thanks.
This code works just fine for me.
So, the solution is that you have to re-run qmake because based on your comments, you modified the project structure without telling that to qmake.