error: QNetworkReply: No such file or directory - qt

Something is missing from the pro file it seems:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += hello.h
SOURCES += hello.cpp
QT += webkit
Or there is some other problem?
$qmake -v
QMake version 2.01a
Using Qt version 4.7.0 in /opt/qtsdk-2010.05/qt/lib

This line was missing: QT += network in the .pro file.

Related

Qt5 OpenCV3.4.5 LNK1105 cannot open opencv_world345d.obj

I am building a Qt5 project with OpenCV3.4.5 in windows. The OpenCV is a prebuilt version with opencv_world345.lib and opencv_world345dlib. I create a .pri file for including opencv into the Qt project. Here below is for the opencv .pri file:
INCLUDEPATH += C:/opencv-3.4.5/prebuild/include \
C:/opencv-3.4.5/prebuild/include/opencv \
C:/opencv-3.4.5/prebuild/include/opencv2
Debug: {
LIBS += lc:/opencv-3.4.5/prebuild/x64/vc14/lib/opencv_world345d
}
Release: {
LIBS += lc:/opencv-3.4.5/prebuild/x64/vc14/lib/opencv_world345
}
I also set C:\opencv-3.4.5\prebuild\x64\vc14\bin in the path of systems variables.
Building the project in debug mode gives the error: LINK : fatal error LNK1104: cannot open file 'lc:\opencv-3.4.5\prebuild\x64\vc14\lib\opencv_world345d.obj'.
What causes the error? Do I miss something else in configuring opencv for Qt?
Have you run qmake since making your changes to the .pri file?
Normally I would have asked for clarification in the comments, but I'm new to Stack Overflow and don't have 50 reputation yet.
EDIT:
I found an old project of mine that I have OpenCV3.1.0 properly linked to. Here's what I have in my .pro
LIBS += -L*PATH TO OPEN CV*/OpenCV-3.1.0/lib
INCLUDEPATH += *PATH TO OPEN CV*/OpenCV-3.1.0/include
CONFIG(release, debug|release):{
LIBS += \
-lopencv_world310
}
CONFIG(debug, debug|release):{
LIBS += \
-lopencv_world310d
}
Here below is the modified .pri file that works for me!
INCLUDEPATH += c:/opencv-3.4.5/prebuild/include
CONFIG(release, debug|release):{
LIBS += -L"c:/opencv-3.4.5/prebuild/x64/vc14/lib" -lopencv_world345
}
CONFIG(debug, debug|release):{
LIBS += -L"c:/opencv-3.4.5/prebuild/x64/vc14/lib" -lopencv_world345d
}
The configurations by Debug:{} and Release {} do not work!

Qt error: undefined reference to 'QDebug::~QDebug()'

I am compiling my code with caffe, opencv 3.1 and Qt5.6. Following is my .pro file. I have not included the actual source and header file names here.
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = outsideSituationDetection
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
<and others>
HEADERS += mainwindow.h \
< and others >
FORMS += mainwindow.ui
DEFINES += CPU_ONLY
QMAKE_CXXFLAGS += -std=c++11 -Wall -D_REENTRANT -D__STDC_CONSTANT_MACROS -pthread
QMAKE_CXXFLAGS += -DQT_COMPILING_QSTRING_COMPAT_CPP -DQT_COMPILING_QIMAGE_COMPAT_CPP
CONFIG += link_pkgconfig
PKGCONFIG += opencv
INCLUDEPATH += /usr/local/include /usr/local/lib /usr/lib
DEPENDPATH += /usr/local/include
LIBS += -L/usr/local/lib/ -lopencv_imgproc
LIBS += -lm -lglib-2.0 -lgthread-2.0 -lxml2 -pthread
INCLUDEPATH += /usr/include/glib-2.0
INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include
INCLUDEPATH += /usr/include/libxml2
INCLUDEPATH += /usr/include/ \
/usr/lib/x86_64-linux-gnu/ \
LIBS += -L/usr/lib/x86_64-linux-gnu/ -lglog -lpthread -lm -lrt -ldl -lnsl
DEPENDPATH += /usr/lib/x86_64-linux-gnu/
# BOOST Library
LIBS += -L/usr/lib/x86_64-linux-gnu/ -lboost_system
INCLUDEPATH += /usr/lib/x86_64-linux-gnu
#Caffe for CPU System
INCLUDEPATH += $$PWD/../../../../../src/caffe/build/include \
$$PWD/../../../../../src/caffe/include \
$$PWD/../../../../../src/caffe/build
unix:!macx: LIBS += -L$$PWD/../../../../../src/caffe/build/lib/ -lcaffe -lglog
INCLUDEPATH += $$PWD/../../../../../src/caffe/build
DEPENDPATH += $$PWD/../../../../../src/caffe/build
RESOURCES += icons.qrc
Problem - When I compile the code, I get a bunch of 'error: undefined reference to 'QDebug::~QDebug()'' errors along with 'error: undefined reference to `QDebug::putString(QChar const*, unsigned long)'' against all of my .cpp files. (I have successfully built and executed another application without errors using Qt5.6 and Qt5.7.)
(.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag' File not found (.qtversion[qt_version_tag]+0x0) in main.o
What I have tried - Check Qt version to make sure I am using Qt5.6. Deleted the installed qt5-default by doing 'sudo apt-get remove qt5-default'. Downgraded from Qt5.7 to Qt5.6 although it didn't make any difference. I have deleted qt4 and qt5 folders from /usr/include and /usr/share.
Can you please suggest what I might be missing?
I had multiple declarations of ' #include "QDebug" ' in files. Removing them and having it in only one file removed the error. (edit- it's incorrect and doesn't work)
What worked - Though I had removed older versions of Qt 3, 4 & 5 , qt was internally using 5.2.1 versions. I do not know where they came from. But when I deleted them all in /usr/lib/x86_linux_gnu/, the code compiled! I also specified the paths to the installed directory explicitly in qtchooser/default.conf. This may not be the best way to do but it worked anyway.

Qt: cannot find DLLs even if I specify their location

I cannot understand why this Qt pro file does not work:
QT += core
QT += gui
TARGET = PrjName
CONFIG += qt
CONFIG += console
TEMPLATE = app
INCLUDEPATH += C:/Qt/4.8.4/include/Qt
QMAKE_LIBDIR += C:/Qt/4.8.4/bin
LIBS += -lQtCore4
LIBS += -lQtGui4
SOURCES += ...
HEADERS += ...
These are the linker errors:
error: cannot find -lQtGui
error: cannot find -lQtCore
The C:\Qt\4.8.4\bin directory exists, and the DLLs are there.
Thank you.
Platform: Windows 7, MinGW, Qt 4.8.4, QtCreator 2.8.0

Linking dll to c++ in qt for reading .mat files

I am using Qt Creator 2.4.1(Based on Qt 4.7.4) ..
Now I want to open the .mat file which I got from Matlab.
I am using the basic function matOpen
Initially, I knew the headers required. They are mat.h, matrix.h and tmw.h.
Now, before running the code, I need to link the libraries. The required libraries as far as I know are libmat.dll and libmw.dll . I added them to the .pro file as follows.
QT += core
QT -= gui
TARGET = mat_open_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
HEADERS += \
mat.h \
matrix.h \
tmwtypes.h
LIBS += -L"C:\Users\skanduri\Documents\C ++\mat_open_test-build-desktop- Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug\libmat.dll"
LIBS += -L"C:\Users\skanduri\Documents\C ++\mat_open_test-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug\libmx.dll"
Still I get error as : undefined reference to matOpen.. m sure the problem is with the linking.. But I dunno how to solve it. and the compiler Qt is using is MinGw .
You are specifying library path only, not the libraries itself. Try
LIBS += -L"C:\Users\skanduri\Documents\C ++\mat_open_test-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug"
LIBS += -llibmx
LIBS += -llibmat

qmake not generating binary resource files

Specs: Qt Creator 2.5.1, Qt 4.7.4(32bit)
It is my understanding from the Qt documentation that including a resource (.qrc) in the .pro file of Qt is all that is required to get qmake to generate the correct qrc_*.cpp files. That doesn't seem to be the case for my project. When running qmake the makes files are created and there are references to the qrc_ file I'm looking for under compiler_rcc_clean, just not in the build chain.
[Update]
At a suggestion from comments below the makefile generated by qmake was tested directly w/ NMAKE. The correct qrc_filter_ao.cpp file was created. However the IDE still fails to properly generate this file when I build from Qt Creator.
.pro:
include (../../shared.pri)
TARGET = filter_ao
QT += opengl
HEADERS += ./filter_ao.h
SOURCES += ./filter_ao.cpp
RESOURCES += \
filter_ao.qrc
shared.pri
include (./general.pri)
VCGDIR = ../$$VCGDIR
TEMPLATE = lib
CONFIG += plugin
CONFIG += resources
QT += opengl
QT += xml
QT += xmlpatterns
QT += script
win32-msvc2008: LIBS += ../../distrib/common.lib
win32-msvc2008:DEFINES += GLEW_STATIC _USE_MATH_DEFINES
INCLUDEPATH *= ../.. $$VCGDIR ../$$GLEWDIR/include
DEPENDPATH += ../.. $$VCGDIR
win32-msvc2008:DEFINES += _CRT_SECURE_NO_DEPRECATE
CONFIG(release,debug | release){
# Uncomment the following line to disable assert in mingw
#DEFINES += NDEBUG
}
DESTDIR = ../../distrib/plugins
contains(TEMPLATE,lib) {
CONFIG(debug, debug|release) {
unix:TARGET = $$member(TARGET, 0)_debug
else:TARGET = $$member(TARGET, 0)d
}
}
win32-msvc2008: RCC_DIR = $(ConfigurationName)
general.pri
VCGDIR = ../../../vcglib
GLEWDIR = ../external/glew-1.7.0
win32:DEFINES += NOMINMAX
I think #Pie_Jesu is correct. I have set up a directory structure with the files from the OP, and imported the .pro file into QtCreator. I have removed the "win32-msvc2008: " prefix from the line which sets RCC_DIR since I am using VS Express 2010.
Result was that I get a message like "Unable to open \qrc_filter_ao.cpp for writing: Access denied" and no qrc_file is being created.
I then set the line to /TEMP:
RCC_DIR = /TEMP
Result is that I find the qrc_ file below \TEMP.
Did you try with a simpler .pro file? For instance, the following works for me (On Linux, no MSVC env available currently):
TEMPLATE = lib
CONFIG += plugin
CONFIG += resources
QT += opengl
QT += xml
QT += xmlpatterns
QT += script
TARGET = filter_ao
QT += opengl
RESOURCES += \
filter_ao.qrc
Make sure that the output of from the build contain a call to $QTDIR/rcc, like
/usr/bin/rcc -name filter_ao filter_ao.qrc -o qrc_filter_ao.cpp

Resources