Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Problem with simple Class

$
0
0
Hi, I’m newbie in Qt, I’m created my own very simple class. And when I want to create some object of my class something goes wrong. I don’t know what’s going on. Probably I missed something in code. Let take a look on my code. Thanks! My class: tree.h #ifndef TREE_H #define TREE_H   #include <QPoint>   class Tree {   public:       QPoint wsp;     int stan;       Tree();     Tree(int Tstan, int Twsp_x, int Twsp_y);     Tree(const Tree & Ttree);     };   #endif // TREE_H TREE.CPP #include "Tree.h"   Tree::Tree() { }   Tree::Tree(const Tree &Ttree) {     stan = Ttree.stan;     wsp = Ttree.wsp;   }   Tree::Tree(int Tstan, int Twsp_x, int Twsp_y) {     stan = Tstan;     wsp.setX(Twsp_x);     wsp.setY(Twsp_y); } And the last one main.cpp #include <QApplication> #include <QVector> #include "drzewo.h" #include "window.h"     int main(int argc, char *argv[]) {    // QVector <Tree> Forest;     Tree One(20,20,0);   // <- Here is the problem       QApplication a(argc, argv);     window w;     w.show();         return a.exec(); } This is very simple and works perfect in clear C++ in VS2012 but in QT something goes wrong. My error looks like this: main.obj:-1: error:LNK2019: unresolved external symbol "public: __cdecl Tree::Tree(int,int,int)" (??0Tree@@QEAA@HHH@Z) referenced in function main   debug\Fire.exe:-1: error:LNK1120: 1 unresolved externals

Viewing all articles
Browse latest Browse all 18427

Trending Articles