QDialog not found during the compilation - c++

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

Related

Getting the error "Unknown module in QT: positioning" in Qt Creator, when trying to run the SimpleBrowser example

I bought and downloaded QtCreator and I'm trying to run the SimpleBrowser example:
https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-simplebrowser-example.html
When I build the project I get the error:
Unknown module in QT: positioning
I think the reason might be that I bought the Design Tools version of Qt Creator, and this module is not included in the Design Tools purchase.
Is this the reason for my error message? If I buy the Development Tools version of Qt Creator, will the error go away, and will my environment have the Qt WebEngine C++ classes, along with all it needs to build the SimpleBrowser example?
I tried adding Qt += positioning to my project file and it doesn't make a difference. Here is the project file:
QT += core gui
QT += positioning
QT += webenginewidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
HEADERS += \
browser.h \
browser.h \
browserwindow.h \
browserwindow.h \
downloadmanagerwidget.h \
downloadmanagerwidget.h \
downloadwidget.h \
downloadwidget.h \
tabwidget.h \
tabwidget.h \
webpage.h \
webpage.h \
webpopupwindow.h \
webpopupwindow.h \
webview.h \
webview.h
SOURCES += \
browser.cpp \
browser.cpp \
browserwindow.cpp \
browserwindow.cpp \
downloadmanagerwidget.cpp \
downloadmanagerwidget.cpp \
downloadwidget.cpp \
downloadwidget.cpp \
main.cpp \
tabwidget.cpp \
tabwidget.cpp \
webpage.cpp \
webpage.cpp \
webpopupwindow.cpp \
webpopupwindow.cpp \
webview.cpp \
webview.cpp
FORMS += \
certificateerrordialog.ui \
certificateerrordialog.ui \
downloadmanagerwidget.ui \
downloadwidget.ui \
passworddialog.ui \
passworddialog.ui \
downloadmanagerwidget.ui \
downloadwidget.ui
RESOURCES += data/simplebrowser.qrc
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
What a coincidence, we're trying to open the same project. I solved it by actually installing the QPositioning module using the maintenance.exe in the Qt Installation Folder (Typically in C:\Qt).

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.

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"

qt c++ error: curl/curl.h: No such file or directory

I downloaded the libcURL source code and imported the headers and source into my .pro file and it seems to find all the libraries except for the main one.
dies on:
#include <curl/curl.h>
.pro file contains:
(this is the updated version)....................
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = RESTtest
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlMulti.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlHeader.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlVersion.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlEasy.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlShare.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlMessage.cpp \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/src/CurlHttpPost.cpp \
HEADERS += mainwindow.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlEasy.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlInterface.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlMulti.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlPair.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlVersion.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlHttpPost.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlHeader.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlShare.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlMessage.h \
../../../../../Users/Brad2/Documents/GitHub/curlcpp/include/CurlError.h \
FORMS += mainwindow.ui
win32:LIBS += -L"../../../../../Users/Brad2/Documents/GitHub/curl-7.34.0-rtmp-ssh2-ssl-sspi-zlib-winidn-static-bin-w64" -lcurl
INCLUDEPATH += "../../../../../Users/Brad2/Documents/GitHub/curlcpp/include"
INCLUDEPATH += "../../../../../Users/Brad2/Documents/GitHub/curlcpp/src"
INCLUDEPATH += "../../../../../Users/Brad2/Documents/GitHub/curl/include"
INCLUDEPATH += "../../../../../Users/Brad2/Documents/GitHub/curl/include/curl"
OTHER_FILES += \
../../../../../Users/Brad2/Documents/GitHub/curl-7.34.0-rtmp-ssh2-ssl-sspi-zlib-winidn-static-bin-w64/curl.exe \
../../../../../Users/Brad2/Documents/GitHub/curl-7.34.0-rtmp-ssh2-ssl-sspi-zlib-winidn-static-bin-w64/libeay32.dll \
../../../../../Users/Brad2/Documents/GitHub/curl-7.34.0-rtmp-ssh2-ssl-sspi-zlib-winidn-static-bin-w64/libcurl.dll \
../../../../../Users/Brad2/Documents/GitHub/curl-7.34.0-rtmp-ssh2-ssl-sspi-zlib-winidn-static-bin-w64/ssleay32.dll \
../../../../../Users/Brad2/Documents/GitHub/curl-7.34.0-rtmp-ssh2-ssl-sspi-zlib-winidn-static-bin-w64/mk-ca-bundle.vbs
Install this:
apt-get install libcurl4-openssl-dev
apt-get install libcurl4-gnutls-devĀ