executable runs fine from local directory / throws error with IDE.
-
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; }
-
Don't include opencv2 in your INCLUDEPATH entry
INCLUDEPATH += "C:/OpenCV-2.3.1/install/include/"
-
I don't see any opencv2 in your includepath unless you are referring to the opencv2 down the file directory from there.
INCLUDEPATH += "C:\OpenCV-2.3.1\install\include\opencv2"
Sorry, now I am feeling newbish.
-
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.
-
@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
-
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; }
-
@Technologist said:
-llibopencv_core2411.dll.a
Hi,
if you use the flag
-l
you have to omit thelib
prefix and the extensions-llibopencv_core2411
-
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
-
Then just to be sure: which Qt package are you using ?
-
The version is qt 5.4
Using 64 bit osOn 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.