Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. File .obj not found on Windows
Qt 6.11 is out! See what's new in the release blog

File .obj not found on Windows

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 6.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Norrbotten
    wrote on last edited by
    #1

    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.

    jsulmJ 1 Reply Last reply
    0
    • N Norrbotten

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Norrbotten Can you provide the whole build log?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Also, please delete any .user file in the project folder and re setup the project with the kits.

        N 1 Reply Last reply
        0
        • mrjjM mrjj

          Also, please delete any .user file in the project folder and re setup the project with the kits.

          N Offline
          N Offline
          Norrbotten
          wrote on last edited by
          #4

          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
          .h
          #ifndef SOMECLASS_H
          #define SOMECLASS_H

          #include <QObject>
          #include <QWidget>

          class someClass : public QObject
          {
          Q_OBJECT
          public:
          explicit someClass(QObject *parent = nullptr);

          signals:

          public slots:
          void DoSomething();
          };

          #endif // SOMECLASS_H

          .cpp

          #include "someclass.h"
          #include <QMessageBox>

          someClass::someClass(QObject *parent) : QObject(parent)
          {

          }

          void someClass::DoSomething()
          {
          QMessageBox msg;
          msg.setText("Hi");
          msg.exec();

          }

          main
          #include "mainwindow.h"
          #include "ui_mainwindow.h"
          #include "someclass.h"
          someClass *myClass;
          MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);
          myClass=new someClass(this);
          }

          MainWindow::~MainWindow()
          {
          delete ui;
          }
          Errors:
          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.sueM 1 Reply Last reply
          0
          • N Norrbotten

            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
            .h
            #ifndef SOMECLASS_H
            #define SOMECLASS_H

            #include <QObject>
            #include <QWidget>

            class someClass : public QObject
            {
            Q_OBJECT
            public:
            explicit someClass(QObject *parent = nullptr);

            signals:

            public slots:
            void DoSomething();
            };

            #endif // SOMECLASS_H

            .cpp

            #include "someclass.h"
            #include <QMessageBox>

            someClass::someClass(QObject *parent) : QObject(parent)
            {

            }

            void someClass::DoSomething()
            {
            QMessageBox msg;
            msg.setText("Hi");
            msg.exec();

            }

            main
            #include "mainwindow.h"
            #include "ui_mainwindow.h"
            #include "someclass.h"
            someClass *myClass;
            MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
            {
            ui->setupUi(this);
            myClass=new someClass(this);
            }

            MainWindow::~MainWindow()
            {
            delete ui;
            }
            Errors:
            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.sueM Offline
            m.sueM Offline
            m.sue
            wrote on last edited by m.sue
            #5

            Hi @Norrbotten

            You use explicit with your someClass contructor which means you have to explicitly cast QWidget * (the thisin myClass=new someClass(this);) to QObject * in MainWindow::MainWindow.

            -Michael.

            N jsulmJ 2 Replies Last reply
            1
            • m.sueM m.sue

              Hi @Norrbotten

              You use explicit with your someClass contructor which means you have to explicitly cast QWidget * (the thisin myClass=new someClass(this);) to QObject * in MainWindow::MainWindow.

              -Michael.

              N Offline
              N Offline
              Norrbotten
              wrote on last edited by
              #6

              @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
              #ifndef GLWIDGET_H
              #define GLWIDGET_H

              #include <QGLWidget>

              class GLWidget : public QGLWidget
              {
              Q_OBJECT
              public:
              *explicit GLWidget(QWidget parent = 0);

              public slots:
              void RePaint();
              void initializeGL() ;
              void paintGL() ;
              void resizeGL(int w, int h);

              protected:
              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?

              jsulmJ 1 Reply Last reply
              0
              • N Norrbotten

                @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
                #ifndef GLWIDGET_H
                #define GLWIDGET_H

                #include <QGLWidget>

                class GLWidget : public QGLWidget
                {
                Q_OBJECT
                public:
                *explicit GLWidget(QWidget parent = 0);

                public slots:
                void RePaint();
                void initializeGL() ;
                void paintGL() ;
                void resizeGL(int w, int h);

                protected:
                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?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Norrbotten Can you please post the whole build log?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • m.sueM m.sue

                  Hi @Norrbotten

                  You use explicit with your someClass contructor which means you have to explicitly cast QWidget * (the thisin myClass=new someClass(this);) to QObject * in MainWindow::MainWindow.

                  -Michael.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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
                  

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  N 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @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
                    
                    N Offline
                    N Offline
                    Norrbotten
                    wrote on last edited by
                    #9

                    Hi, in case some one have the same problem.
                    I receive help from support.
                    in .h have to be

                    #include <QtGui/QOpenGLFunctions_1_1>
                    class bscanclass : public QGLWidget, QOpenGLFunctions_1_1
                    {
                    Q_OBJECT
                    public:
                    explicit bscanclass(QWidget *parent = 0);

                    call from main:
                    bscanclass *BscanW; // declaration

                    and then
                    BscanW=new bscanclass(this);

                    Working perfect now. Thank you very much for trying to help

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved