c++ libxml2 xmlReadFile was not declared in this scope - c++

i use libxml2 in my Qt project i create it on linux where was everthing ok. Now I trie compile it on windows where i have this error.
C:\Users\Martin\Desktop\Prace-revize\revize\mainwindow.cpp:52: Error: 'xmlReadFile' was not declared in this scope
doc = xmlReadFile(jmenoSouboru.c_str(), NULL, 0);
^
omg every time it write that i must write more details
project file :
#-------------------------------------------------
#
# Project created by QtCreator 2014-03-25T07:37:57
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = revize
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
pridani.cpp
HEADERS += mainwindow.h \
knihovna.h \
miniz.h \
pridani.h \
datum.h
FORMS += mainwindow.ui \
pridani.ui
QMAKE_CXXFLAGS +=-std=gnu++11
win32: LIBS += -L$$PWD/../../../../../knihovny/libxml2/lib/ -lxml2
INCLUDEPATH += $$PWD/../../../../../knihovny/libxml2/include
DEPENDPATH += $$PWD/../../../../../knihovny/libxml2/include
win32-g++: PRE_TARGETDEPS += $$PWD/../../../../../knihovny/libxml2/lib/libxml2.a
everything is in this C:\knihovny\libxml2

Related

How to add PoDoFo external library to my C++ project in Qt Creator?

I am using Qt Creator, Qt6, C++ for my program.
I would like to use the PoDoFo library but I have no knowledge of how to add the library/headers so that I can use it in my project and build it.
I have downloaded the PoDoFo code, just can't find any guidance/tutorials on how to add PoDoFo specifically in Qt Creator.
Edit: I tried "Add Library" to my project and used external library option. Once I finish, I try to compile my code and I get an error "podofo-0.9.7\COPYING.LIB:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x62DC"
I can include the podofo.h file but that will also throw this error:"podofo-0.9.7\src\podofo\base\PdfCompilerCompat.h:44: error: C1083: Cannot open include file: 'podofo_config.h': No such file or directory"
.pro file:
QT += core gui sql printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
#QMAKE_CXXFLAGS += -std=c++17
SOURCES += \
addbookdialog.cpp \
addbooksdialog.cpp \
bookdetailswindow.cpp \
bulkdetailsdialog.cpp \
cleanebooksdialog.cpp \
insertlinkdialog.cpp \
inserttabledialog.cpp \
linkcollectiondialog.cpp \
linkmanagerwindow.cpp \
main.cpp \
mainwindow.cpp \
searchnamedialog.cpp \
summarywindow.cpp
HEADERS += \
addbookdialog.h \
addbooksdialog.h \
bookdetailswindow.h \
bulkdetailsdialog.h \
cleanebooksdialog.h \
common.h \
insertlinkdialog.h \
inserttabledialog.h \
linkcollectiondialog.h \
linkmanagerwindow.h \
mainwindow.h \
queries.h \
searchnamedialog.h \
summarywindow.h
FORMS += \
addbookdialog.ui \
addbooksdialog.ui \
bookdetailswindow.ui \
bulkdetailsdialog.ui \
cleanebooksdialog.ui \
insertlinkdialog.ui \
inserttabledialog.ui \
linkcollectiondialog.ui \
linkmanagerwindow.ui \
mainwindow.ui \
searchnamedialog.ui \
summarywindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES += \
style.qss
RESOURCES += \
images.qrc \
style.qrc
unix|win32: LIBS += -L$$PWD/3rdparty/podofo-0.9.7/ -lCOPYING
INCLUDEPATH += $$PWD/3rdparty/podofo-0.9.7/src/podofo
DEPENDPATH += $$PWD/3rdparty/podofo-0.9.7/src/podofo
qt creator add library dialog:
Did you take a look on this link: https://doc.qt.io/qt-5/third-party-libraries.html?
I just followed it and my 3rdParty library (https://github.com/cutelyst/simple-mail) was linked and accessible from my application C++.
Basically, your .pro file will look like this after setting everything properly:
TARGET = MyQtApp
TEMPLATE = app
INCLUDEPATH += 3rdparty/CatWhisperer/include
SOURCES += src/main.cpp
LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer

:-1: error: LNK1104: cannot open file 'libboost_date_time-vc141-mt-x64-1_71.lib'

I use Qt 4.10.0 in windows 7.
When I tried to compile my project, error occurs:
:-1: error: LNK1104: cannot open file 'libboost_date_time-vc141-mt-x64-1_71.lib'
-------------------------------------------------
#
# Project created by QtCreator 2015-12-23T11:43:59
#
#-------------------------------------------------
QT += core gui
QT += serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MDT
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
checkboxheader.cpp \
ft_file_info.cpp \
ui_dll_function.cpp \
ui_utility.cpp \
startprocess.cpp \
qmdttimer.cpp \
usbswitch.cpp
HEADERS += mainwindow.h \
checkboxheader.h \
ft_file_info.h \
ui_dll_function.h \
ui_utility.h \
startprocess.h \
qmdttimer.h \
QMtrace.h \
usbswitch.h
FORMS += mainwindow.ui
INCLUDEPATH += ./DownloadLib
LIBS += -LD:\EPS_projects\2018to2019\29_IOT_MDI\IoT_MDT_official\lib -
lDownloadLib \
QMTRACE.lib \
EfuseLibrary.lib \ -
LD:\EPS_projects\2018to2019\29_IOT_MDI\IoT_MDT_official\boost_1_71_0\libs \
RESOURCES += \
icons.qrc
#LIBS += -L$$PWD/lib/ -lQMTRACE / -lEfuseLibrary
#INCLUDEPATH += $$PWD/.
#DEPENDPATH += $$PWD/.
LIBS += -L$$PWD/lib/ -lEfuseLibrary
#win32: LIBS += -L$$PWD/lib/ -lEfuseLibrary
#win32: LIBS += -L$$PWD/lib/ -lusb_relay_device
INCLUDEPATH += $$PWD/DownloadLib
I use boost boost_1_71_0 in my project.

'png.h' file not found, when included in qt widget project

i'm trying to make a QT Widgets project. I have to use a "libpng" library, but i'm having a trouble including it. Here is the config .pro file.
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = coursework2
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += c++11
SOURCES += \
main.cpp \
mainwindow.cpp \
INCLUDEPATH += $(LIBRARY_SHARE)/libpng/include
LIBS += -L$(LIBRARY_SHARE)/libpng/lib -lpng
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
This is the solution, which worked for lots of people (found it somewhere), but has no result for me. When i try to include it in main.cpp file, this error pops up:
'png.h' file not found
#include "png.h"
^~~~~~~
How can i fix it?
The solution was pretty simple. I made a mistake in the root to "libpng".
I had to change my 2 lines of code:
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib/libpng

QDialog not found during the compilation

I request your knowledge about QT.
Do you know why during the compilation a moc file cannot find include from QT ?
I currently have this problem in Qt Project, the error is
"moc_SettingsDialog.cpp:9: In file included from moc_SettingsDialog.cpp:9:
SettingsDialog.h:12: error : 'QDialog' file not found".
This my pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2018-12-04T14:58:35
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = cashRegister
TEMPLATE = app
message($${INCLUDEPATH})
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
main.cpp \
cashRegister.cpp \
sources/settings.cpp \
sources/settingsBuilder.cpp \
sources/parseConfFile.cpp \
sources/SupplyList.cpp \
sources/Item.cpp \
sources/SettingsDialog.cpp \
sources/TpeNetwork.cpp \
sources/ManagerNetwork.cpp \
sources/BillNetwork.cpp \
sources/PaymentServerNetwork.cpp \
sources/NetworkFactory.cpp \
sources/Customer.cpp \
sources/Cart.cpp
HEADERS += \
cashRegister.h \
includes/settings.h \
includes/settingsBuilder.h \
includes/parseConfFile.h \
includes/SupplyList.h \
includes/Item.h \
includes/Mybutton.h \
includes/SettingsDialog.h \
includes/TpeNetwork.h \
includes/ManagerNetwork.h \
includes/BillNetwork.h \
includes/PaymentServerNetwork.h \
includes/NetworkFactory.h \
includes/NetworkCode.h \
includes/networkabstract.h \
includes/networkinterface.hpp \
includes/Customer.h \
includes/Cart.h
FORMS += \
cashRegister.ui \
SettingsDialog.ui
macx {
_BOOST_PATH = /usr/local/Cellar/boost/1.68.0
INCLUDEPATH += "$${_BOOST_PATH}/include/"
LIBS += -L$${_BOOST_PATH}/lib -lboost_regex
}
unix:!macx {
LIBS += -L"/usr/lib/x86_64-linux-gnu" -lboost_regex
INCLUDEPATH += /usr/include/boost
DEPENDPATH += /usr/include/boost
DEFINES += QT_NO_VERSION_TAGGING
}
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
config.qrc
Qt Version : 5.12.0
OS: MacOS 10.14 and Ubuntu

How to integrate QT with novint falcon?

Novint falcon is integrated using the HDAL SDK on Visual Studio. I could not find any documentation online to install the SDK on QT. I tried to include the HDAl library and header files in my QT project. The .pro file looks like this.The error is
:-1: error: No rule to make target '../imagesegment/hdl.h', needed by 'debug/main.o'. Stop.
#-------------------------------------------------
#
# Project created by QtCreator 2014-11-04T14:24:33
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = imagesegment
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
haptics.cpp \
gshaptics.cpp \
main_dx9.cpp \
main_opengl.cpp \
StdAfx.cpp
HEADERS += \
hdl.h \
hdlConstants.h \
hdlErrors.h \
hdlExports.h \
hdlu.h \
hdluExports.h \
adll.h \
afuncs.h \
atypes.h \
avars.h \
glut.h \
haptics.h \
StdAfx.h \
Widget.h
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/lib/ -lhdl
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/lib/ -lhdld
INCLUDEPATH += $$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/include
DEPENDPATH += $$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/include
Figured it out. We need to add the header files and libs as mentioned in the qmake documentation on qt website. Try to save qt in a folder with 'no spaces' in it's path.
TEMPLATE = app
TARGET = cube4
QT += 3d
SOURCES = cubeview.cpp main.cpp \
haptics.cpp
HEADERS = cubeview.h \
haptics.h \
src/haptics.h \
src/adll.h \
src/afuncs.h \
src/atypes.h \
src/avars.h \
src/glut.h \
src/StdAfx.h \
hdl/hdl.h \
hdl/hdlConstants.h \
hdl/hdlErrors.h \
hdl/hdlExports.h \
hdlu/hdlu.h \
hdlu/hdluExports.h
HEADERS += \
Widget.h
RESOURCES = cube.qrc
CONFIG += exceptions
win32:LIBS += $$quote(C:/Program Files/Novint/HDAL_SDK_2.1.3/lib/hdl.lib)
INCLUDEPATH += $$quote("$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/include/hdl")
INCLUDEPATH += $$quote("$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/include/hdlu")
INCLUDEPATH += $$quote("$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/examples/Basic/src")
win32: INCLUDEPATH +="C:/Program Files/Novint/HDAL_SDK_2.1.3/include"