Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
ZBAR and QT
i´m working on windows with QT 5.2 and MinGW. I tried to integrate the ZBAR libs into my Project by copying the files (zbar.h und the zbar folder with the other headers) into my Project folder and adding in my .pro file
HEADERS += zbar.h
INCLUDEPATH += /zbar/
but i get these errors
In function 'ZN4zbar12ImageScannerC1EPNS_20zbar_image_scanner_sE':
undefined reference to `zbar_image_scanner_create´
using namespace zbar;
int main(int argc, char *argv)
QApplication a(argc, argv);
//This is part of ZBar, just added it for testing ImageScanner scanner; return a.exec();
hope somebody can help
steno last edited by
If its a library, you have to add it to LIBS += \ and add to INCLUDEPATH where the headers are. If you plan on building it, you also have to add the cpp's.
Ok, i changed my .pro file in
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = zbar_gui_app
TEMPLATE = app
SOURCES += main.cpp
SOURCES += mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
LIBS += -L$$PWD/lib/ -llibzbar-0.lib
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include
and added a folder "lib" which contains
libzbar-0.lib, libzbar-0.def and libzbar.dll.a
furthermore i moved the headers in the folder "include".
But now i get a Prompt saying "During startup programm exited with code 0x0000135"
steno last edited by
Does the ZBar library have other dependencies? If so, they need to be added to the LIBS as well. Other than that, I'm not sure what's going on.
I don't think so. If you want, you can try it yourself.
Link to ZBAR http://zbar.sourceforge.net/
Thanks for your help.
Learn last edited by
do you know how to link the zbar now?
Leonardo last edited by Leonardo
It's very straightforward:
LIBS += -llibzbar-0
The author said he compiled the library with MinGW. Because of that zbar will depend on libgcc_s_dw2-1.dll, MinGW's runtime library. I'd say that the error he reported was caused by him missing this dll in his search path.
Learn last edited by Learn
I don't understand what you mean
So if i ant to use zbar, i need to compile with MINGW?
I can't just use origin lib file without modify it ?
Leonardo last edited by
I mean that if the library was compiled with MinGW, you might have unexpected dependencies. That's how you get the error he reported. Dependencies are missing.