Unsolved Integrate Qt 5.6 to an existing VisualStudio 2017 Project -> unresolved external symbols (Moc file problem)
-
Hello,
I've spend a lot of time to get Qt running on VisualStudio 2017. This works so far with projects that are created with the Qt wizard.
But my goal is to integrate Qt into an existing project.I followed this steps from a forum:
-Install QT Add In (for visual studio 2015 is in still in beta, but works fully for me). -Right click the project, select "Unload project". -Add add the <keyword>Qt4VSv1.0</keyword> entry into the <PropertyGroup Label="Globals"> tag. // Qt4VSv1.0 -Select load project. -Select "Convert project to Qt Add-in project" in "Qt 5" menu. -Almost done. Go to Qt project settings and Qt option in the Qt menu to set details. -In your project properties Linker\Additional Library Directories\ might need to add $(QTDIR)\lib -In your project properties C++\Aditinal include directories\ might need to add $(QTDIR)\include -In each of your class derived from Q_OBJECT, delete the Q_OBJECT macro, save the file, return the Q_OBJECT macro (Ctrl+Z) and save again. It adds the 'moc' files to your generated files folder.
Afterwards I implemented a QTcpSocket object into a funtion which raised no IntelliSense errors but when this get's compiled the following error complains about unresolved QtscpSocket...:
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand Fehler LNK1120 8 nicht aufgelöste Externe BraceWorxsVwxPlg C:\Users\admin\Documents\VW_RELEASE\VWX2019\BraceWorxsVwxPlg.vlb 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __cdecl QTcpSocket::QTcpSocket(class QObject *)" (__imp_??0QTcpSocket@@QEAA@PEAVQObject@@@Z)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __cdecl QString::~QString(void)" (__imp_??1QString@@QEAA@XZ)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __cdecl QString::QString(char const *)" (__imp_??0QString@@QEAA@PEBD@Z)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: __cdecl QMessageBox::QMessageBox(class QWidget *)" (__imp_??0QMessageBox@@QEAA@PEAVQWidget@@@Z)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: void __cdecl QMessageBox::setText(class QString const &)" (__imp_?setText@QMessageBox@@QEAAXAEBVQString@@@Z)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: virtual __cdecl QTcpSocket::~QTcpSocket(void)" (__imp_??1QTcpSocket@@UEAA@XZ)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: virtual __cdecl QMessageBox::~QMessageBox(void)" (__imp_??1QMessageBox@@UEAA@XZ)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1 Fehler LNK2001 Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: virtual int __cdecl QDialog::exec(void)" (__imp_?exec@QDialog@@UEAAHXZ)". BraceWorxsVwxPlg C:\Users\admin\Documents\DEV\BraceWorxsPlugin\TestMenu.obj 1
With some further research I found out that this has to do with the moc files, they are not gernerated. I could not find any solution and would be very thankfull about any help.
regards,
Patrick -
Hi and welcome to devnet,
From the looks of it, it's currently rather that you are not linking against the Qt core, widgets and network modules which are needed following the missing symbol list.