I have got an issue while integrating opencv 3.1 with Qt 5.6.
the project .pro file contains
INCLUDEPATH += C:/opencv/build/include
LIBS += -LC:/opencv/build/x64/vc14/lib
INCLUDEPATH += LIBS += -lopencv_world310
but gives undefined reference errors like:
error: undefined reference to `cv::VideoCapture::VideoCapture()
I have even tried using cmake, but it still gives the same error.
Thanks in advance for your help.
Related
I have installed LibRaw-0.20.1.zip from https://www.libraw.org/download.
I compile it, and produce libraw.lib and libraw.dll. It is 32 bit.
I then use it in qt:
win32: LIBS += -L$$PWD/../../LibRaw-0.20.0/lib/ -llibraw
INCLUDEPATH += $$PWD/../../LibRaw-0.20.0
DEPENDPATH += $$PWD/../../LibRaw-0.20.0
This path is right, but I get this is error:
C:\QtProject\UDP\mainwindow.cpp:359: error: undefined reference to `LibRaw::LibRaw(unsigned int)'
I have the following configuration in the .pro file
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += thread
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/opencv4
LIBS += -L/usr/local/lib/
LIBS += -lopencv_core
LIBS += -lopencv_highgui
LIBS += -lopencv_imgproc
LIBS += -lopencv_videoio
QMAKE_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0
INCLUDEPATH += /path/to/libtorch/include
INCLUDEPATH += /path/to/libtorch/include/torch/csrc/api/include
LIBS += -L/path/to/libtorch/lib
LIBS += -ltorch -lc10
OpenCV works absolutely fine without "QMAKE_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0". With this, however, I get this following errors:
OpenCV works fine with "QMAKE_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=1" as well. But it throws a different set of errors:
Setting "QMAKE_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0" has been recommended for Libtorch in most of the forums to avoid the errors above.
What could be a solution or some solutions to work around this?
(I am a newbie to both Libtorch and Qt Creator.)
Maybe OpenCV and Libtorch were compiled with a different version of GCC (and different values of _GLIBCXX_USE_CXX11_ABI).
Try recompiling them by yourself and see if things change.
The problem is that you downloaded the wrong ABI version of LibTorch. It looks like that you downloaded the Pre-CXX11 ABI version of LibTorch and OpenCV is compiled with CXX11 ABI. So if you set _GLIBCXX_USE_CXX11_ABI=0, OpenCV throws errors, and if you set _GLIBCXX_USE_CXX11_ABI=1, LibTorch throws errors.
Download the CXX11 ABI LibTorch from PyTorch official website and you won't need to set the _GLIBCXX_USE_CXX11_ABI flag.
About the dual ABI problem of GCC, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
I'm using Qt 5.8 and gsl 2.1 (compiled with cygwin64). This is what I use in the .pro file to link gsl:
INCLUDEPATH+=C:/gsl/include/
INCLUDEPATH += C:/gsl/LIBS
LIBS += -LC:/gsl/lib -lgsl -lgslcblas -lm
When I include the headers and compile, I don't have any problem, even when I declare and object. But when I try to use any function I get this error:
C:\Users\CIFAS-1\untitled4\mainwindow.cpp:9: error: undefined reference to `gsl_matrix_alloc'.
I already solve the problem, I found a compiled version of gsl for mingw32 here https://code.google.com/archive/p/gsl-w32/downloads, it is another version but works great.
I'm with Qt 5.5 on Windows 10 64 bit with MingW compiler.
I'm trying to compile my project in debug mode => Works perfectly
But in release mode, I have these errors:
undefined reference to `TileMap::XYToNode(int, int) const'
undefined reference to `TileMap::XYToNode(int, int) const'
./release\perso.o: bad reloc address 0xc in section `.rdata'
collect2.exe:-1: erreur : error: ld returned 1 exit status
I have tried to do clean, qmake, and rebuild, but there are still errors.
I use some SFML dlls, and dlls I created. My TileMap class inherits a SFML class, and a micropather class (which is in one of the dlls).
Yes, I have tried Google before.
The .pro file:
TEMPLATE = app
TARGET = TealDemo
QT = widgets
SOURCES += ........
LIBS += -LC:/Qt/5.5/SFML/lib -LC:/Qt/5.5/micropather/lib -LC:/Qt/5.5/pathstore/lib
CONFIG(release): LIBS += -lsfml-graphics -lsfml-main -lsfml-window -lsfml-system -lmp -lpathstore
CONFIG(debug): LIBS += -lsfml-graphics-d -lsfml-main-d -lsfml-window-d -lsfml-system-d -lmpd -lpathstored
INCLUDEPATH += C:/Qt/5.5/SFML/include C:/Qt/5.5/micropather/include C:/Qt/5.5/pathstore/include
DEPENDPATH += C:/Qt/5.5/SFML/include C:/Qt/5.5/micropather/include C:/Qt/5.5/pathstore/include
HEADERS += .......
CONFIG += C++11 warn_on
debug {
DEFINES += TEAL_DEBUG
}
How to resolve this ?
Thanks
I deleted the inline before the function in the .cpp file, and it worked... Such strange.
Some days ago I compiled Boost ver. 1.53.0 for VS2012. It works fine, compiles fine. Now I want to use Boost with Qt Creator. In the .pro file I've included
INCLUDEPATH += C:\boost\boost_1_53_0\ -lboost_filesystem
LIBS += C:/boost/boost_1_53_0/stage/lib/
But when I compile I get 2 errors:
:-1: error: cannot find C:/boost/boost_1_53_0/stage/lib/: Permission denied
collect2.exe:-1: error: error: ld returned 1 exit status
What should I do? I've googled but seems I'm the first with this error.
INCLUDEPATH += C:\boost\boost_1_53_0\ -lboost_filesystem
LIBS += C:/boost/boost_1_53_0/stage/lib/
Wrong.
Read this.
Solution:
INCLUDEPATH += C:/boost/boost_1_53_0/
LIBS += "-LC:/boost/boost_1_53_0/stage/lib/"
Boost has complicated library names ("libboost_filesystem-vc90-mt-1_53.lib") and in case of msvc it links them automatically.)
If you want to link additional lib, you do it like this:
LIBS += "-LMyLibraryPath" -lmylib
Where MyLibraryPath is library path, and mylib is library you want to link with.
i'm the first with this error.
The error most likely occurs because compiler tries to open directory as if it were a file or something like that.
win32 {
INCLUDEPATH += C:/Users/User/Downloads/dev/boost_1_61_0
LIBS += "-LC:/dev/Boost/lib/" \
"-Llibboost_filesystem-mgw53-mt-d-1_61.a", "-Llibboost_system-mgw53-mt-d-1_61.a", "-Llibboost_serialization-mgw53-mt-d-1_61.a" -LLIBS
}