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"
}
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'm trying to run a simple application in Qt creator using DCMTK libraries and it doesn't work as it should. I receive the following message:
error: undefined reference to `DicomImage::DicomImage(char const*, unsigned long, unsigned long, unsigned long)'
main.cpp:
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmimgle/dcmimage.h"
#include "iostream"
int main(int argc, char *argv[])
{
DicomImage *image = new DicomImage("test.dcm");
if (image != NULL){
std::cout << "hell yeah!";
}
return 0;
}
.pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2016-02-18T19:16:51
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled1
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
#------------------
CONFIG += c++11
INCLUDEPATH += "C:\Program Files (x86)\DCMTK_1\include"
LIBS += -L"C:\Program Files (x86)\DCMTK_1\lib"
LIBS +=-ldcmimgle -ldcmdata -loflog -lofstd
win32:LIBS += -lAdvapi32 -lofstd -loflog -ldcmdata -ldcmnet -ldcmimage -ldcmimgle -lws2_32 -lnetapi32 -lwsock32
I think something is wrong with .pro file but I cannot figure out. I have included the necessary libraries and still no use.. I read that for DCMTK the order of libraries is important but I think it is already in order and cannot figure out what could be. Can you provide a solution to this problem?
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.
I try to compile one of my project I made with windows 7 64 bits using Qt5.3.1 MSVC2012, by using now Qt5.4 gcc 64 bits with Unbuntu 14.04 LTS.
But I have some "undefined reference to" errors :
/home/innocore/Software/CES_2015/trunk/MainProgram/../bin//libSmartphoneController.a(smartphonecontroller.o): In function SmartphoneController::init()':
/home/innocore/Software/CES_2015/trunk/bin/../LibSmartphoneController/smartphonecontroller.cpp:11: undefined reference toRemoteADBInterface::RemoteADBInterface(QString, QString, int, QObject*)'
/home/innocore/Software/CES_2015/trunk/bin/../LibSmartphoneController/smartphonecontroller.cpp:13: undefined reference to RemoteADBInterface::newMessage(RemoteADBInterface::Message const&, QVariant const&)'
/home/innocore/Software/CES_2015/trunk/MainProgram/../bin//libSmartphoneController.a(smartphonecontroller.o): In functionQMetaObject::Connection QObject::connect(QtPrivate::FunctionPointer::Object const*, void (RemoteADBInterface::)(RemoteADBInterface::Message const&, QVariant const&), QtPrivate::FunctionPointer::Object const, void (SmartphoneController::*)(RemoteADBInterface::Message const&, QVariant const&), Qt::ConnectionType)':
/opt/5.4/gcc_64/include/QtCore/qobject.h:239: undefined reference to `RemoteADBInterface::staticMetaObject'
collect2: error: ld returned 1 exit status
my project is composed of one exe and several libraries like libSmartphoneController.a or libRemoteADB.a.
All the libraries compile correctly and are created in the right directory. The problem occurs when I compile my exe program (MainProgram).
In the .pro, I'm sure I include the right dependencies :
unix:!macx {
CONFIG(release, release|debug) {
LIBS += -L$$PWD/../Lib/ -lAudioPlayer -lDisplay -lSWCom -lRemoteADB -lDMS -lTVRemote \
-lHDMIMixer -lSmartphoneController -lRemoteServer
}
CONFIG(debug, release|debug) {
LIBS += -L$$PWD/../bin/ -lAudioPlayer -lDisplay -lSWCom -lRemoteADB -lDMS -lTVRemote \
-lHDMIMixer -lSmartphoneController -lRemoteServer
} }
The lib SmartphoneController also have two dependencies :
in SmartphoneController.pro :
unix:!macx {
CONFIG(release, release|debug) {
LIBS += -L$$PWD/../Lib/ -lRemoteADB -lRemoteServer
}
CONFIG(debug, release|debug) {
LIBS += -L$$PWD/../bin/ -lRemoteADB -lRemoteServer
} }
The problem is that it does not find the definition of some function in the lib RemoteADB (contructor, signal readMessage...). I don't have any problem with all other libs + it compiles perfectly on windows...
Any idea ?
Thanks in advance for your help
I see a possible cause for your problem: the compiler does not find the library file and you can solve this by adding in the .pro file the full path where you have saved the libraries, what I can see here is that you have different path where to search libraries if are compiling debug or release, are you sure you have the correct libraries in both places ?
This would be an example of what to put in your pro file:
LIBS += -L$$OUT_PWD/../../../projects/mylibs/release/
I am currently having a link error with Qt.
I cant compile my code since i got the error message:
error: undefined reference to `cv::imread(cv::String const&, int)'
Heres the content of my .pro
QT += core
QT -= gui
TARGET = edge_detection
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
Heres my simple code:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
int main(){
cv::Mat img;
img=cv::imread("/home/cgross/Downloads/2.jpg");
return 0;
}
I am not sure of where is the problem
includepath must show opencv and opencv2.just like that:
INCLUDEPATH += C:\\opencv-2.4.6.1\\build-msvc2012\\install\\include
LIBS+=-LC:\\opencv-2.4.6.1\\build-msvc2012\\install\\lib \
-lopencv_calib3d246d \
-lopencv_contrib246d \
-lopencv_core246d \
-lopencv_features2d246d \
-lopencv_flann246d \
lıbs must show .lib file
Your code builds and runs just fine for me on a somewhat antique stock ubuntu 12.10 with opencv 2.3 from the distribution packages.
It picks up a cv::imread(std::string const &, int) from libopencv_highgui.