QT creator LNK2019 meaning?

I have been programming in c++ for about six months now. Just recently i started to make a blackjack simulator in QT creator, which means i am very new to the QT environment. I have created a few classes i thought was needed etc. Everything works out fine until i try to create a class object in my mainWindow.h!

So the problem pops up when im trying to create a Deals object. I also create a new Deals(); in the .cpp file ofc.

The error message i get is called LNK2019. I have been googling around for a while to understand what it actually means and how i can understand the error statements.

In this specific case the errorcode looks like this:

mainblackjackmainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl Deals::Deals(void)" (??0Deals@@QEAA@XZ) referenced in function "public: __cdecl MainBlackJackMainWindow::MainBlackJackMainWindow(class QWidget *)" (??0MainBlackJackMainWindow@@QEAA@PEAVQWidget@@@Z)

how should i read this to be able to understand it? And if u have any ideas or tips on how to solve this i would be glad.

Best regards J
In the function MainBlackJackMainWindow::MainBlackJackMainWindow(QWidget*) (the constructor, I'd guess), you are trying to default construct a Deals object (hence the reference to Deals::Deals()) but the linker can't find a definition for it. I'd suspect you've written the prototype but not actually supplied the implementation anywhere (or are at least forgetting to link it).
I do have a default constructor for Deals and implemented it 2.
This is how it looks right now.

1
2
3
4
5
6
7
8
Deals.cpp

#include"Deals.h"

Deals::Deals()
{
//what so ever
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
MainWindow.h
#include"deals"

class MainBlackJackMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainBlackJackMainWindow(QWidget *parent = 0);
    ~MainBlackJackMainWindow();

private slots:
    void on_TakeCardButton_clicked();

    void on_StopPushButton_clicked();

private:
    Ui::MainBlackJackMainWindow *ui;

    Deals *myDeals; 

};



1
2
3
4
5
6
7
8
9
10
11
12
13
mainWindow.cpp
#include"mainWindow.h"

MainBlackJackMainWindow::MainBlackJackMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainBlackJackMainWindow)
{
    ui->setupUi(this);

    this->myDeals=new Deals();
}



I also read somewhere that Qt-creator wants every class function to be implemented (Even if it's just empty atm). So i tried that 2, But it didnt work.
Not sure on how to move on from here :P

Best regards J
Did you link the object files together? The linker might not be finding the implementation of Deals() from the point of view of mainWindow.cpp.
When you say link the files together how do you mean? If you are asking me if i included the files together then the answer is yes. Otherwise im not sure ^^
Topic archived. No new replies allowed.