Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. LINK1104: "D:\Windows.obj" file not found while building a simple opencv project.
Forum Updated to NodeBB v4.3 + New Features

LINK1104: "D:\Windows.obj" file not found while building a simple opencv project.

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
27 Posts 5 Posters 5.8k Views 3 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.
  • S Offline
    S Offline
    Somesh Singh
    wrote on last edited by koahnig
    #1

    Hey guys,
    i have been trying to build a simple image reading script using opencv from the tutorial given on the Qt wiki page after adding all the files and libraries in my .pro file i get this linker error.
    My .pro file looks like this

    #-------------------------------------------------
    #
    # Project created by QtCreator 2019-02-06T19:10:21
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = Test1
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which has been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    CONFIG += c++11
    
    SOURCES += main.cpp \
            mainwindow.cpp
    
    HEADERS += mainwindow.h
    
    FORMS += mainwindow.ui
    
    INCLUDEPATH += D:\OpenCV\opencv\build\include
    #INCLUDEPATH += D:\OpenCV\opencv\build\install\x64\vc15\bin
    INCLUDEPATH += "D:\Windows Kits\10\Include\10.0.17763.0\ucrt"
    INCLUDEPATH += "D:\Windows Kits\10\Include\10.0.17763.0\ucrt\sys"
    
    LIBS += D:\Windows Kits\10\Lib\10.0.17763.0\um\x64\shell32.lib
    LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_core400.dll
    LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_highgui400.dll
    LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_imgcodecs400.dll
    LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_imgproc400.dll
    LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_features2d400.dll
    LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_calib3d400.dll
    
    # Default rules for deployment.
    #qnx: target.path = /tmp/$${TARGET}/bin
    #else: unix:!android: target.path = /opt/$${TARGET}/bin
    #!isEmpty(target.path): INSTALLS += target
    
    --------------------------------------------------------------------------------------------------------------------------
    

    and my mainwindow.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include <opencv2\core\core.hpp>
    #include <opencv2\highgui\highgui.hpp>
    
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    	
    
        // read an image
        cv::Mat image = cv::imread("C:\\Users\\somup\\OneDrive\\Desktop\1.jpg", 1);
        // create image window named "My Image"
        cv::namedWindow("My Image");
        // show the image on window
        cv::imshow("My Image", image);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
     -----------------------------------------------------------------------------------------------------------
    

    the compiler i am running is Qt 5.12.0 msvc2017 x64 with the default debugger from windows
    0_1549581493560_8dc890cb-406f-4f2b-8c74-d2c82a135843-image.png
    Can you please help me with this
    please
    thank you

    [koahing:code tags added]

    K J.HilkJ 2 Replies Last reply
    0
    • S Somesh Singh

      Hey guys,
      i have been trying to build a simple image reading script using opencv from the tutorial given on the Qt wiki page after adding all the files and libraries in my .pro file i get this linker error.
      My .pro file looks like this

      #-------------------------------------------------
      #
      # Project created by QtCreator 2019-02-06T19:10:21
      #
      #-------------------------------------------------
      
      QT       += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = Test1
      TEMPLATE = app
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which has been marked as deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      CONFIG += c++11
      
      SOURCES += main.cpp \
              mainwindow.cpp
      
      HEADERS += mainwindow.h
      
      FORMS += mainwindow.ui
      
      INCLUDEPATH += D:\OpenCV\opencv\build\include
      #INCLUDEPATH += D:\OpenCV\opencv\build\install\x64\vc15\bin
      INCLUDEPATH += "D:\Windows Kits\10\Include\10.0.17763.0\ucrt"
      INCLUDEPATH += "D:\Windows Kits\10\Include\10.0.17763.0\ucrt\sys"
      
      LIBS += D:\Windows Kits\10\Lib\10.0.17763.0\um\x64\shell32.lib
      LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_core400.dll
      LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_highgui400.dll
      LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_imgcodecs400.dll
      LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_imgproc400.dll
      LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_features2d400.dll
      LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_calib3d400.dll
      
      # Default rules for deployment.
      #qnx: target.path = /tmp/$${TARGET}/bin
      #else: unix:!android: target.path = /opt/$${TARGET}/bin
      #!isEmpty(target.path): INSTALLS += target
      
      --------------------------------------------------------------------------------------------------------------------------
      

      and my mainwindow.cpp

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      
      #include <opencv2\core\core.hpp>
      #include <opencv2\highgui\highgui.hpp>
      
      
      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      	
      
          // read an image
          cv::Mat image = cv::imread("C:\\Users\\somup\\OneDrive\\Desktop\1.jpg", 1);
          // create image window named "My Image"
          cv::namedWindow("My Image");
          // show the image on window
          cv::imshow("My Image", image);
      }
      
      MainWindow::~MainWindow()
      {
          delete ui;
      }
       -----------------------------------------------------------------------------------------------------------
      

      the compiler i am running is Qt 5.12.0 msvc2017 x64 with the default debugger from windows
      0_1549581493560_8dc890cb-406f-4f2b-8c74-d2c82a135843-image.png
      Can you please help me with this
      please
      thank you

      [koahing:code tags added]

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Somesh-Singh

      Hi and welcome to devnet forum

      What happens with a simple project without opencv?

      FYI as noted above I have added code tags to your post.
      Please use code tags for marking code snippets and log output. Code tags are introduced by the "</>" above your post window.

      Vote the answer(s) that helped you to solve your issue(s)

      S 1 Reply Last reply
      3
      • S Somesh Singh

        Hey guys,
        i have been trying to build a simple image reading script using opencv from the tutorial given on the Qt wiki page after adding all the files and libraries in my .pro file i get this linker error.
        My .pro file looks like this

        #-------------------------------------------------
        #
        # Project created by QtCreator 2019-02-06T19:10:21
        #
        #-------------------------------------------------
        
        QT       += core gui
        
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        
        TARGET = Test1
        TEMPLATE = app
        
        # The following define makes your compiler emit warnings if you use
        # any feature of Qt which has been marked as deprecated (the exact warnings
        # depend on your compiler). Please consult the documentation of the
        # deprecated API in order to know how to port your code away from it.
        DEFINES += QT_DEPRECATED_WARNINGS
        
        # You can also make your code fail to compile if you use deprecated APIs.
        # In order to do so, uncomment the following line.
        # You can also select to disable deprecated APIs only up to a certain version of Qt.
        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
        
        CONFIG += c++11
        
        SOURCES += main.cpp \
                mainwindow.cpp
        
        HEADERS += mainwindow.h
        
        FORMS += mainwindow.ui
        
        INCLUDEPATH += D:\OpenCV\opencv\build\include
        #INCLUDEPATH += D:\OpenCV\opencv\build\install\x64\vc15\bin
        INCLUDEPATH += "D:\Windows Kits\10\Include\10.0.17763.0\ucrt"
        INCLUDEPATH += "D:\Windows Kits\10\Include\10.0.17763.0\ucrt\sys"
        
        LIBS += D:\Windows Kits\10\Lib\10.0.17763.0\um\x64\shell32.lib
        LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_core400.dll
        LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_highgui400.dll
        LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_imgcodecs400.dll
        LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_imgproc400.dll
        LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_features2d400.dll
        LIBS += D:\OpenCV\opencv\build\bin\Release\opencv_calib3d400.dll
        
        # Default rules for deployment.
        #qnx: target.path = /tmp/$${TARGET}/bin
        #else: unix:!android: target.path = /opt/$${TARGET}/bin
        #!isEmpty(target.path): INSTALLS += target
        
        --------------------------------------------------------------------------------------------------------------------------
        

        and my mainwindow.cpp

        #include "mainwindow.h"
        #include "ui_mainwindow.h"
        
        #include <opencv2\core\core.hpp>
        #include <opencv2\highgui\highgui.hpp>
        
        
        MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
        	
        
            // read an image
            cv::Mat image = cv::imread("C:\\Users\\somup\\OneDrive\\Desktop\1.jpg", 1);
            // create image window named "My Image"
            cv::namedWindow("My Image");
            // show the image on window
            cv::imshow("My Image", image);
        }
        
        MainWindow::~MainWindow()
        {
            delete ui;
        }
         -----------------------------------------------------------------------------------------------------------
        

        the compiler i am running is Qt 5.12.0 msvc2017 x64 with the default debugger from windows
        0_1549581493560_8dc890cb-406f-4f2b-8c74-d2c82a135843-image.png
        Can you please help me with this
        please
        thank you

        [koahing:code tags added]

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Somesh-Singh
        additionally to what @koahnig said, can you show us the Compile Output tab instead of the Issues tab, that should have more information, about what is going wrong.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        S 1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @Somesh-Singh
          additionally to what @koahnig said, can you show us the Compile Output tab instead of the Issues tab, that should have more information, about what is going wrong.

          S Offline
          S Offline
          Somesh Singh
          wrote on last edited by
          #4

          @J.Hilk
          Sorry about that
          i have this in my compiler output
          0_1549664999048_c9b97167-c352-47be-8b43-914e5ad91687-image.png

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            You seem to have both a CMakelist.txt file and a .pro file. Which are you using to build your project ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 1 Reply Last reply
            0
            • K koahnig

              @Somesh-Singh

              Hi and welcome to devnet forum

              What happens with a simple project without opencv?

              FYI as noted above I have added code tags to your post.
              Please use code tags for marking code snippets and log output. Code tags are introduced by the "</>" above your post window.

              S Offline
              S Offline
              Somesh Singh
              wrote on last edited by
              #6

              @koahnig
              Without opencv it builds fine..
              like the example files given by the qt builds without any problem.
              I am not sure if the environment is not set as required or i am not including some paths.
              can you please help me with this.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                I missed on thing: you don't link against .dll files, you link against .lib files, you should start by fixing that.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 1 Reply Last reply
                1
                • SGaistS SGaist

                  Hi,

                  You seem to have both a CMakelist.txt file and a .pro file. Which are you using to build your project ?

                  S Offline
                  S Offline
                  Somesh Singh
                  wrote on last edited by
                  #8

                  @SGaist
                  I am just using the .pro file
                  the Cmake file is just me trying to figure out a way to loop back to working conditions with opencv.
                  but the .pro file gives me this error.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    As already written, fix the LIBS statement to link against the OpenCV libraries properly.

                    You can use Qt Creator add library feature for that.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • SGaistS SGaist

                      I missed on thing: you don't link against .dll files, you link against .lib files, you should start by fixing that.

                      S Offline
                      S Offline
                      Somesh Singh
                      wrote on last edited by
                      #10

                      @SGaist
                      I fixed that ...its still the same.
                      I think it has to do something with some header files maybe

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by SGaist
                        #11

                        Does it happen when you try to link against the HighGui library ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        S 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Does it happen when you try to link against the HighGui library ?

                          S Offline
                          S Offline
                          Somesh Singh
                          wrote on last edited by
                          #12

                          @SGaist yeah it still shows the same error.
                          i even tried including the libraries one by one..it still does not work
                          Do you think my code has some problems??

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Do you mean, you have that problem when you link any of the OpenCV libraries ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            S 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Do you mean, you have that problem when you link any of the OpenCV libraries ?

                              S Offline
                              S Offline
                              Somesh Singh
                              wrote on last edited by
                              #14

                              @SGaist Yes
                              I tried using MingW compiler and it works fine with the building of the CmakeLists.txt file and i get the required output.
                              its just the compiler MSVC15 2017 x64 that i s not able to build the project.
                              Even with the Cmake it does not run as intended.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                On Windows, you can't mix and match C++ libraries built with different compilers. The only exception currently is VS2017 being backward compatible with VS2015.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                S 1 Reply Last reply
                                1
                                • SGaistS SGaist

                                  On Windows, you can't mix and match C++ libraries built with different compilers. The only exception currently is VS2017 being backward compatible with VS2015.

                                  S Offline
                                  S Offline
                                  Somesh Singh
                                  wrote on last edited by
                                  #16

                                  @SGaist
                                  So why am i getting the error for the ".obj" file not found
                                  As shown in the example that i posted..its just configured to be used with Qt 5.12.0MSVC2017 x64
                                  So why does it not work.

                                  i was just trying different ways to make it work with a different compiler to check the integrity of my program .

                                  kshegunovK 1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    You should compare the Makefile generated by your CMake project and the one from the .pro file

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    S 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      You should compare the Makefile generated by your CMake project and the one from the .pro file

                                      S Offline
                                      S Offline
                                      Somesh Singh
                                      wrote on last edited by
                                      #18

                                      @SGaist
                                      Is there something specific that i should be looking for??
                                      I am not an expert in debugging by just looking at the 2 files.

                                      1 Reply Last reply
                                      0
                                      • S Somesh Singh

                                        @SGaist
                                        So why am i getting the error for the ".obj" file not found
                                        As shown in the example that i posted..its just configured to be used with Qt 5.12.0MSVC2017 x64
                                        So why does it not work.

                                        i was just trying different ways to make it work with a different compiler to check the integrity of my program .

                                        kshegunovK Offline
                                        kshegunovK Offline
                                        kshegunov
                                        Moderators
                                        wrote on last edited by
                                        #19

                                        @Somesh-Singh said in LINK1104: "D:\Windows.obj" file not found while building a simple opencv project.:

                                        So why am i getting the error for the ".obj" file not found

                                        @SGaist said in LINK1104: "D:\Windows.obj" file not found while building a simple opencv project.:

                                        On Windows, you can't mix and match C++ libraries built with different compilers. The only exception currently is VS2017 being backward compatible with VS2015.

                                        Let's go back a step. Firstly your LIBS variable is incorrect. Secondly you're linking system libraries which from the code example it seems you shouldn't. And thirdly, if a set of libraries worked with mingw then they were compiled with mingw (hence the quote from @SGaist). That set of libraries can not, and shall not be used with msvc, ever. You need a set of libraries compiled with msvc to use them in an application built with msvc. This also extends to the msvc version - for example msvc2015 isn't backwards compatible, so you likely need to match the versions as well.

                                        Read and abide by the Qt Code of Conduct

                                        S 1 Reply Last reply
                                        1
                                        • kshegunovK kshegunov

                                          @Somesh-Singh said in LINK1104: "D:\Windows.obj" file not found while building a simple opencv project.:

                                          So why am i getting the error for the ".obj" file not found

                                          @SGaist said in LINK1104: "D:\Windows.obj" file not found while building a simple opencv project.:

                                          On Windows, you can't mix and match C++ libraries built with different compilers. The only exception currently is VS2017 being backward compatible with VS2015.

                                          Let's go back a step. Firstly your LIBS variable is incorrect. Secondly you're linking system libraries which from the code example it seems you shouldn't. And thirdly, if a set of libraries worked with mingw then they were compiled with mingw (hence the quote from @SGaist). That set of libraries can not, and shall not be used with msvc, ever. You need a set of libraries compiled with msvc to use them in an application built with msvc. This also extends to the msvc version - for example msvc2015 isn't backwards compatible, so you likely need to match the versions as well.

                                          S Offline
                                          S Offline
                                          Somesh Singh
                                          wrote on last edited by
                                          #20

                                          @kshegunov

                                          I have specific set of libraries for both mingw and msvc.
                                          Also, i linked the system libraries in the .pro file as it was not accepting them from the system variables "PATH"
                                          My issue is just during the compilation with opencv.

                                          For eg., Qt has its included examples just to try out for beginners, those examples run completely fine, which means the problem lies somewhere in the code itself which i wrote.

                                          0_1549927377207_2c5e7161-0e8d-46f7-a940-69a67ad3e1ed-image.png

                                          these are all the compilers i have which are seperately

                                          0_1549927469876_fbd57746-4af4-4f11-9815-73b8d8dda0c1-image.png

                                          I need to get my default compiler to work with opencv.
                                          thats my end goal

                                          kshegunovK 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