Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
File .obj not found on Windows
Hi, I wanted to add some new functions to my program I created with free Qt version using my registered one. I use another Windows computer now and it looks like installation of Qt was OK because I can run demo examples. But for some reason although I can see missing files on debug folder I get errors (23 !)
like this "unresolved external symbol_xxx File not found xxx.obj" I know that I didn't have those errors when I finished the project for 2 years ago! Where can be the problem? I'm not using Qt on Windows on normal case , mostly on Linux, now I have no idea what to do. The function have to be added and delivered to customer 15 August. Any help will be appreciated.
@Norrbotten Can you provide the whole build log?
Also, please delete any .user file in the project folder and re setup the project with the kits.
hi, I already did it and nothing happens. I found that the only part of the code with class (C++ class) added to project gives the problem. Project was done on the older version of QT, maybe now is it different way to add classes to the project?
I created a new a new empty project and just added a C++ class (base class QObject with included Q Widget).
And it will not work
class someClass : public QObject
explicit someClass(QObject *parent = nullptr);
#endif // SOMECLASS_H
someClass::someClass(QObject *parent) : QObject(parent)
MainWindow::MainWindow(QWidget *parent) :
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl someClass::someClass(class QObject *)" (??0someClass@@QEAA@PEAVQObject@@@Z) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
debug\TestObjErrors.exe:-1: error: LNK1120: 1 unresolved externals
m.sue last edited by m.sue
explicitwith your someClass contructor which means you have to explicitly cast
myClass=new someClass(this);) to
@m.sue I used this way for few years ago . The software working fin (executable I created at that time) no such problems as I have now I had at that time
class GLWidget : public QGLWidget
*explicit GLWidget(QWidget parent = 0);
void initializeGL() ;
void paintGL() ;
void resizeGL(int w, int h);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
#endif // GLWIDGET_H
Must probably the syntactic was changed while I didn't use Qt . How otherwise have I declare the class?
@Norrbotten Can you please post the whole build log?
@m.sue explicit only tells the compiler to not to use the constructor for implicit type conversions like:
QObject* obj; someClass sClass = obj; // Without explicit compiler would use someClass(QObject *parent = nullptr) constructor to convert QObject* to someClass, with explicit this line will cause a compiler error
Hi, in case some one have the same problem.
I receive help from support.
in .h have to be
class bscanclass : public QGLWidget, QOpenGLFunctions_1_1
explicit bscanclass(QWidget *parent = 0);
call from main:
bscanclass *BscanW; // declaration
Working perfect now. Thank you very much for trying to help