Unresolved external symbol errors in basic project
-
wrote on 23 Jul 2018, 06:44 last edited by enjoysmath
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl Editor::Editor(class QString &,class QMainWindow *)" (??0Editor@@QEAA@AEAVQString@@PEAVQMainWindow@@@Z) referenced in function "private: void __cdecl MainWindow::on_actionNew_triggered(void)" (?on_actionNew_triggered@MainWindow@@AEAAXXZ)
On a very basic app. I created an Editor class using the C++ header / source convention and am getting weird errors like this. No cyclically included headers.
Is this a no brainer or do you need more info from me?
I am getting these even though I write out the functions in the header file and remove the editor.cpp from the project. IT'S WEIRD.
-
Hi,
Did you properly export/import the class ?
Can you show the header you wrote ?
-
wrote on 23 Jul 2018, 07:05 last edited byThis post is deleted!
-
wrote on 23 Jul 2018, 07:06 last edited by enjoysmathThis post is deleted!
-
wrote on 23 Jul 2018, 07:14 last edited by
@SGaist Still getting the error. Here is my editor.h:
#ifndef EDITOR_H #define EDITOR_H #include <QMainWindow> #include <QGraphicsView> class Editor : public QGraphicsView { public: Editor(QString& name, QMainWindow* window); QString& tabName(); private: QMainWindow* m_window; QString m_name; }; #endif // EDITOR_H
And my editor.cpp:
#include "editor.h" Editor::Editor(QString& name, QMainWindow* window) { m_name = name; m_window = window; } QString& Editor::tabName() { return m_name; }
-
wrote on 23 Jul 2018, 07:30 last edited by
Okay I fixed it by just creating a Qt Form Class with the new item wizard and renaming everything with QWidget to QGraphicsView, etc
-
Can you show your new version of your code ?
1/7