How can I use libraw in QT? - c++

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)'

Related

OpenCV 3.1 with Qt 5.6

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.

C++ Qt MingW bad reloc 0xc address in section rdata

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.

Undefined reference for external library (C++, QT, Ubuntu 14, CCV)

I'm trying to run the CCV library linked at http://libccv.org/ in QT Creator on Ubuntu 14. I followed this tutorial http://libccv.org/tutorial/ and I'm trying now to run the first simple example. I get these errors:
error: undefined reference to ccv_read_impl(void const*, ccv_dense_matrix_t**, int, int, int, int)
error: undefined reference to ccv_write(ccv_dense_matrix_t*, char*, int*, int, void*)
This is the .pro file of the project:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
unix:!macx: LIBS += -L$$PWD/../../../CNN/ccv/lib/ -lccv
INCLUDEPATH += $$PWD/../../../CNN/ccv/lib
DEPENDPATH += $$PWD/../../../CNN/ccv/lib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../CNN/ccv/lib/libccv.a
Finally this is the command generated by QT in the compile output:
g++ -m64 -o ccv1 main.o -L/home/fabri/QT/CCV1/ccv1/../../../CNN/ccv/lib/ -lccv
I suppose it's a compiler problem but I don't know what. Thank you.
Modify the example and try to include it like this:
extern "C" {
#include "ccv.h"
}

Qt/C++ linkage error (undefined reference)

I have troubles when I'm trying to make a linkage with static C/C++ library. Using QtCreator 2.7.2/Qt4.8/RHEL6. Here .pro file:
QT += core gui widgets
DESTDIR = ../bin
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
LIBS += -L$$PWD/../bin/ -lsip
INCLUDEPATH += $$PWD/../sip/include
TARGET = sipgui
TEMPLATE = app
SOURCES += main.cpp\
....
HEADERS += \
connectionpool.h \
....
FORMS += dialog.ui
unix|win32: LIBS += -lcurses
When I'm calling library method from my project, i get "undefined reference" compilation error:
thread.o: In function `print_last_stats':
/home/virtual/Project/sip/build-sipgui-Desktop-Debug/../sipgui/thread.cpp:61: undefined reference to `print_statistics'
....
/home/virtual/Project/sip/build-sipgui-Desktop-Debug/../sipgui/thread.cpp:64: undefined reference to `print_statistics'
/home/virtual/Project/sip/sipgui/../bin//libsip.a(sipp-scenario.o): In function `scenario::parseAction(CActions*)':
/home/virtual/Desktop/sipp-3.4.1/sipp-3.4.1/src/scenario.cpp:1627: undefined reference to `hasMedia'
So, what am I doing wrong?

How do I use the Boost libraries in a qmake project?

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
}