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. executable runs fine from local directory / throws error with IDE.
Forum Updated to NodeBB v4.3 + New Features

executable runs fine from local directory / throws error with IDE.

Scheduled Pinned Locked Moved General and Desktop
27 Posts 4 Posters 6.3k Views 4 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #21

    That's the point. Since you use:

    #include <opencv2/core/core.hpp>

    If you use INCLUDEPATH += "C:/OpenCV-2.3.1/install/include/opencv2/" then the headers won't be found because you are trying to include a file that would be searched like:
    "C:/OpenCV-2.3.1/install/include/opencv2/opencv2/core/core.hpp".

    So either remove opencv2 from your include lines or remove it from your INCLUDEPATH line.

    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
    0
    • TechnologistT Technologist

      FYI the platform was built using cmake and mingw, not MSVS (I don't have msvs on the system.) -- if that's coming across from the ?path?. Was it this line: %OPENCV%\buildx86\vc11Honestly I think I put it in the path mistakenly. Can I remove it?

      OK cleaned my path. No more missing qt files with Widgets addition to pro file. Application still continue to crash in intialization phase. Sometimes it will throw this error a lot of the time or just open a window and crash. Below it can't find an opencv file.

      The program can't start because libgcc_s_dw2-1.dll is missing from your computer Try installing the program to fix this problem.
      

      New local path: C:\OpenCV-2.3.1\bin;C:\OpenCV-2.3.1\install\include\opencv2;C:\OpenCV-2.3.1\lib;
      System path:%OPENCV%\build\x86\vc11\bin; c:\OpenCV-2.3.1\bin;C:\opencv-win\opencv\sources\modules;

      error :C:\Users\Technologist\Documents\NewOne\main.cpp:2: error: opencv2/core/core.hpp: No such file or directory #include <opencv2/core/core.hpp>
      ^
      pro. file:

      QT       += core
      
      QT       += gui
      QT       += widgets
      
      TARGET = NewOne
      CONFIG   += console
      CONFIG   -= app_bundle
      
      TEMPLATE = app
      
      SOURCES += main.cpp
      
      INCLUDEPATH += "C:/OpenCV-2.3.1/install/include/opencv2/"
      
      LIBS += -LC:\OpenCV-2.3.1\lib\
          -lopencv_core2411.dll.a \
          -lopencv_highgui2411.dl.al \
          -lopencv_imgproc2411.dll.a \
          -lopencv_features2d2411.dll.a \
          -lopencv_calib3d2411.dll.a
      
      #include <QCoreApplication>
      #include <opencv2/core/core.hpp>
      #include <opencv2/highgui/highgui.hpp>
      int main() {
              // read an image
              cv::Mat image= cv::imread("img.jpg");
              // create image window named "My Image"
              cv::namedWindow("My Image");
              // show the image on window
              cv::imshow("My Image", image);
              // wait key for 5000 ms
              cv::waitKey(5000);
              return 1;
      }
      
      
      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #22

      @Technologist said:

      FYI the platform was built using cmake and mingw, not MSVS (I don't have msvs on the system.) -- if that's coming across from the ?path?. Was it this line: %OPENCV%\buildx86\vc11

      Yes, it was that line. "VC11" represents Visual Studio 2012.

      Honestly I think I put it in the path mistakenly. Can I remove it?

      I don't know, as I've never used OpenCV myself. How does OpenCV recommend you set up your libraries?

      OK cleaned my path. No more missing qt files with Widgets addition to pro file. Application still continue to crash in intialization phase. Sometimes it will throw this error a lot of the time or just open a window and crash. Below it can't find an opencv file.

      The program can't start because libgcc_s_dw2-1.dll is missing from your computer Try installing the program to fix this problem.
      

      That's not an error that can only happen "some of the time" for a particular setup -- it either happens all of the time, or it won't happen.

      I suspect that you are trying to launch your app in different ways but then combining their results into one observation. Please be systematic in your investigations: Describe what you do leading up to a specific crash (e.g. "This happens I try to launch my app from the IDE" and "That happens when I try to launch my app from the build directory")

      Note: Launching from a build directory is like trying to run a deployed application. Follow http://wiki.qt.io/Deploy_an_Application_on_Windows carefully

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • TechnologistT Offline
        TechnologistT Offline
        Technologist
        wrote on last edited by Technologist
        #23

        I suspect that you are trying to launch your app in different ways but then combining their results into one observation.. Please be systematic in your investigations.

        The more systematic the better. I am trying to get all my apps, as with any good scientific analysis, running from the same baseline. We have done most of that already by clearing up the header and include file issues, and this has prepared the way for a final solution, easier to see with less stuff being wrong. Now its finally the library error they all seem to share.

        Thx for your time.

        Below: :-1: error: cannot find -llibopencv_core2411.dll.a  :-1: error: cannot find -llibopencv_highgui2411.dll.a
        

        .pro

        QT       += core
        QT       += widgets
        QT       += gui
        
        TARGET = AnotherWack
        CONFIG   += console
        CONFIG   -= app_bundle
        
        TEMPLATE = app
        
        
        SOURCES += main.cpp
        
        INCLUDEPATH += "C:/OpenCV-2.3.1/install/include/"
        
        LIBS += -LC:/OpenCV-2.3.1/lib \
                -llibopencv_core2411.dll.a \
                -llibopencv_highgui2411.dll.a \
        

        main

        #include <QCoreApplication>
        #include <opencv2/core/core.hpp>
        #include <opencv2/highgui/highgui.hpp>
        
        int main() {
                // read an image
                cv::Mat image= cv::imread("img.jpg");
                // create image window named "My Image"
                cv::namedWindow("My Image");
                // show the image on window
                cv::imshow("My Image", image);
                // wait key for 5000 ms
                cv::waitKey(5000);
                return 1;
        }
        
        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #24

          @Technologist said:

          -llibopencv_core2411.dll.a

          Hi,

          if you use the flag -l you have to omit the lib prefix and the extensions -llibopencv_core2411

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • TechnologistT Offline
            TechnologistT Offline
            Technologist
            wrote on last edited by Technologist
            #25

            I'm no longer getting the include and library errors that I was. The main error was getting a build error with a working executable. Now after installing these changes, I get the build error and executable error (they are the same) . Somehow, am chagrin to say, I can't account for the change.They both crash now. I wanted to try putting the DLL in with the executable to see if that would work, but the relevant 5 project dlls were gone (??). I had to poach them from an apparent windows directory vc 11 and copy them to the library that couldn't find them. The same error would continue.

            Present code:
            main.cpp

            #include <QCoreApplication>
            #include <opencv2/core/core.hpp>
            #include <opencv2/highgui/highgui.hpp>
            
            int main() {
            
                // read an image
                cv::Mat image= cv::imread("img.jpg");
                // create image window named "My Image"
                cv::namedWindow("My Image");
                // show the image on window
                cv::imshow("My Image", image);
                // wait key for 5000 ms
                cv::waitKey(5000);
            
                return 1;
            }
            

            .pro

            
            QT       += core
            
            QT       += gui
            QT       += widgets
            
            TARGET = NewOne
            CONFIG   += console
            CONFIG   -= app_bundle
            
            TEMPLATE = app
            
            SOURCES += main.cpp
            
            INCLUDEPATH += C:/OpenCV-2.3.1/install/include/
            
            LIBS += -LC:\OpenCV-2.3.1\lib\
                -lopencv_core2411 \
                -lopencv_highgui2411 \
                -lopencv_imgproc2411 \
                -lopencv_features2d2411\
                -lopencv_calib3d2411
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #26

              Then just to be sure: which Qt package are you using ?

              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
              0
              • TechnologistT Offline
                TechnologistT Offline
                Technologist
                wrote on last edited by Technologist
                #27

                The version is qt 5.4
                Using 64 bit os

                On a few directories I made them the version of the tutorial (OpenCV-2.3.1) to stay on track, but the overall version was 2.4.11 that was downloaded and installed.

                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