2

I have one of this unpopular LNK2019-errors in my project. Perhaps anyone can help me?

That's my header file:

#ifndef ELIST_H
#define ELIST_H

#include <QTableWidget>

class EList : public QTableWidget{
    Q_OBJECT
public:
    explicit EList(QWidget *parent = 0){}
    ~EList(){}
};

#endif // ELIST_H

and that's another cpp-file, where I want to create an object of EList in method do():

#include "elist.h"
#include "a.h"

void A::do(){
    EList* el = new EList;
}

But then I get this LNK2019 error message: a.obj:-1: Error:LNK2019: ""public: __cdecl EList::EList(class QWidget *)" (??0EList@@QEAA@PEAVQWidget@@@Z)" in function ""public: __cdecl A::A(class QWidget *)" (??0A@@QEAA@PEAVQWidget@@@Z)".

What did I wrong or what I have to do? I have insert all files/classes I could imagine but it did not show any effect.


EDIT: Here you can see my pro-File:

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = A
TEMPLATE = app


SOURCES += main.cpp\
        a.cpp \
    elist.cpp

HEADERS  += a.h \
    elist.h

FORMS    += a.ui

RESOURCES += \
    ListViewIcon.qrc

And if I change Compiler (Qt 5.1 MSVC 2012) to Microsoft (Microsoft Visual C++ Compiler 11.0), all files will compiled...

salted
  • 304
  • 1
  • 4
  • 17

1 Answers1

0

With C++ code, you generally can't mix-and-match compilers. Whatever C++ compiler was used to build Qt is what you should be using to build your application. You've basically answered your own question :)

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313