Qt project, no rule to make target needed by - qt

I have a problem with my Makefile. I downloaded opensource Qt project. Hence, when I try to compile it I got a message:
error: No rule to make target needed by stop.
In my .pro file I have relative paths to *.cpp files. So when I replace relative paths to absolute it works, another case it got me with the error above.
System is Linux.
What should I do to do this work with the relative paths?

I would use QtCreator, opening the project and then adding one of the misplaced sources (let say the first you see in .pro).
The IDE should place it with the correct relative path, as appropriate per your folder choice. After that cut'n'paste the path prefix all over the remaining places.
Anyway, path prefixes should be relative to the directory where you find the .pro. An example from an opensource project I'm using (QZXIng, a Qt port of ZXing):
SOURCES += CameraImageWrapper.cpp \
QZXing.cpp \
imagehandler.cpp \
zxing/ResultPointCallback.cpp \
zxing/ResultPoint.cpp \
zxing/Result.cpp \
...
so you could try to move the .pro file where appropriate instead of changing relative paths...

One reason for this issue is because you have removed a file which you no longer need but forgot remove from res.qrc

I had this issue and it was because I had the wrong Kit selected under Projects>Build & Run

I have the same error. My pro file was
HEADERS = \
charectertranformer.h \
filereader.h \
svgview.h \
threadfilereader.h \
serverworker.h \
renderserver.h
SOURCES = \
charectertranformer.cpp \
filereader.cpp \
main.cpp \
svgview.cpp \
threadfilereader.cpp \
serverworker.cpp \
renderserver.cpp \
QT += concurrent
QT += opengl
QT += network
QT += svg
CONFIG -= console
#CONFIG += warn_off exceptions_off
#qmake -svgviewer.pro
deleting backslash after renderserver.cpp helps me

Related

How can I resolve “QML module not found” within Qt Creator

This question is related to the unanswered “Display video in Qml via Gstreamer qmlglsink plugin” question as I have the same problem.
The issue is that Qt Creator cannot find whatever file is necessary to resolve the import “org.freedesktop.gstreamer.GLVideoItem 1.0” statement.
When I create a new QML project and add the import “org.freedesktop.gstreamer.GLVideoItem 1.0” line. I get this error. The project compiles and runs fine.
I have another project taken from an example I downloaded. It uses GstGLVideoItem within its qml file. It also gives the same error and it also compiles and runs fine. It plays the Big Buck Bunny video from a file without issue.
I have totally rebuilt my computer trying to resolve this. Reinstalled Qt 5.15.2 using the online installer and GStreamer 1.18.0 following the instructions on the GStreamer website into an Ubuntu 20.10 PC. Both Qt and GStreamer are working as expected. I have been able to build and run any desired Qt Example without issue. I have also been able to compile and run any of the GStreamer tutorials as well as my own custom pipelines using C and gst-launch-1.0.
This issue occurs within Qt Creator when I bring the two together and try to display a GStreamer video in QML.
I’m new to Linux, Qt, GStreamer, qmake, cmake… How can I debug this? What kind of file is the import statement looking for? Is it a .qml file or some other kind of file? How would I find the files exact name to see if it exists?
Here is the contents of the .pro file for the project that displays the video. I have tried most everything I can find online to resolve this, but no joy.
TEMPLATE = app
QT += qml quick widgets
CONFIG += qml_debug
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig debug
PKGCONFIG += \
gstreamer-1.0 \
gstreamer-sdp-1.0 \
gstreamer-gl-prototypes-1.0 \
gstreamer-gl-1.0 \
gstreamer-gl-egl-1.0 \
gstreamer-app-1.0 \
gstreamer-net-1.0 \
gstreamer-video-1.0 \
gstreamer-controller-1.0 \
gstreamer-rtsp-1.0 \
gstreamer-plugins-base-1.0 \
gstreamer-pbutils-1.0 \
gstreamer-check-1.0 \
gstreamer-allocators-1.0 \
gstreamer-rtp-1.0 \
gstreamer-riff-1.0 \
gstreamer-tag-1.0 \
gstreamer-audio-1.0 \
gstreamer-gl-x11-1.0 \
gstreamer-fft-1.0 \
gstreamer-base-1.0
CONFIG += c++17
INCLUDEPATH += /usr/include/gstreamer-1.0/
INCLUDEPATH += /usr/include/glib-2.0/
INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include/
DEFINES += GST_USE_UNSTABLE_API
INCLUDEPATH += ../lib
SOURCES += main.cpp \
qmlplayer.cpp \
setplaying.cpp
RESOURCES += qmlsink.qrc
QML_IMPORT_PATH += /usr/lib/x86_64-linux-gnu/gstreamer-1.0
QML_IMPORT_PATH += /usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0
QML_IMPORT_PATH += /lib/x86_64-linux-gnu/gstreamer-1.0
HEADERS += \
qmlplayer.h \
setplaying.h
Matthew Waters on the GStreamer forum has answered this question.
I quote him below.
Ah, so your problem is use with the Qt designer not showing finding the
relevant qml code. That use case is currently not supported by qmlglsink.
The issue is that the necessary QML item is contained within the
qmlglsink element itself and is registered dynamically when the element
itself is instantiated. Qt designer doesn't know anything about
GStreamer so cannot perform this initialisation for you. There are no
qmldir or qmltype files for qmlglsink.
The 'fix' involves are rather complicated restructure of the qmlglsink
element to support placing the qml part/plugin in a separate .so that is
findable with Qt tools (using qmldir or whatever).
You might have to dynamicaly register the module before loading the qml on your main as below.
qmlRegisterType<QtGLVideoItem> ("org.freedesktop.gstreamer.GLVideoItem", 1, 0, "GstGLVideoItem");
You will have to create the QtGLVideoItem object which inherits the QtQuickItem class, please see below.
#include <QQuickItem>
class QtGLVideoItem : public QQuickItem
{
Q_OBJECT
public:
QtGLVideoItem();
~QtGLVideoItem();
protected:
private:
};

qmake doesn't search library path

I have a .pro file in which I link my libraries using:
LIBS += -L$${OUTDIR} \
-lA \
-lB \
-lC \
I have developed three libraries A, B, C and this is the fourth library I am trying to build, call it D. libD.so needs to link with others. Since I am putting everything under a bin directorty, I added -L$${OUTDIR} there so that it will look for the bin folder for finding libraries. OUTDIR is a variable I set equal to that bin dir and I am sure it is the correct directory. I print it as a message. But I get the error that libD.so can't find libB.so. I am confused here, it finds other A and C, why it can't find B? They are all under the same directory and I am adding that to library path using -L$${OUTDIR}, so. What could be the problem?
By the way, If a delete that -L$${OUTDIR} and instead add that directory directly to LD_LIBRARY_PATH, from QtCreator Projects tab and build configurations, it finds all the libraries correctly.
Remove \ after -lC
LIBS += -L$${OUTDIR} \
-lA \
-lB \
-lC
It can't find it because at the point in the build where it looks for the library, the library isn't built yet. You need to ensure that the libraries are built in the order of their dependencies.

QMake generating weird paths in makefile

I'm using Qt 5.1.1 and running qmake on windows.
I run qmake with the following command:
qmake.exe -spec win32-msvc2012 -tp vc project.pro
Somehow in my makefile it generates some weird relative paths:
INCPATH = -I"..\..\..\qt\qwt-6.1.0\src"
for example.
My includepaths in the .pro file are the following:
INCLUDEPATH += \
$$PWD \
$$QWTDIR \
what did I do wrong? (The compiler searches for ......\ which it isn't allowed to access for sure)
qwtdir is defined as:
QWTDIR = C:/qt/qwt-6.1.0/src
I resolved the error. Someone committed corrupted .pri file which didn't contain a proper line break after an include i.e.:
HEADERS += \
$$PWD/file1.h \ $$PWD/file2.h
Adding a proper line break solved the issue.
INCLUDEPATH += $$PWD is most likely unnecessary.
Your $$QWTDIR is relative, most likely - you'd need to relent and show it to us. Use $$absolute_path($${QWTDIR}).
You could also probably put the include paths all on one line. The trailing line continuation in the last line of INCLUDEPATH is wrong, you must remove it:
INCLUDEPATH += \
$$PWD \
$$QWTDIR
You are trying to build against the source tree of Qwt ( probably copying the project files of the Qwt examples ) instead of installing Qwt properly and building against the installed version using:
CONFIG += qwt
See http://qwt.sourceforge.net/qwtinstall.html

Cannot Parse Libraries In Linux Using Qt Enviornment

After some helpful tips this is the new version of this post, the thing is that it seems my programs is somehow running but it just issues some errors...i don't know what is it actually mentioning, because the libraries are installed, i changed the path form LIBS += -LC:/usr/local/lib/ \ to LIBS += -L/usr/local/lib/ \ as some one said it's actually refering to windows while u r using linux(chakra) and then added "\" at the end of directories and added pkg-config to my .pro file , so this is the new version of a new problem... :
Starting /home/lucifer/PR0J3CTs/FirstOpenCV-build-desktop-Qt_4_8_2_in_PATH__System__Release/FirstOpenCV...
/home/lucifer/PR0J3CTs/FirstOpenCV-build-desktop-Qt_4_8_2_in_PATH__System__Release/FirstOpenCV exited with code 0
Debugging starts
the debug information found in "/usr/lib/libQtOpenGL.so.4.8.2.debug" does not match "/usr/lib/libQtOpenGL.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtGui.so.4.8.2.debug" does not match "/usr/lib/libQtGui.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtCore.so.4.8.2.debug" does not match "/usr/lib/libQtCore.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtTest.so.4.8.2.debug" does not match "/usr/lib/libQtTest.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtNetwork.so.4.8.2.debug" does not match "/usr/lib/libQtNetwork.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtXml.so.4.8.2.debug" does not match "/usr/lib/libQtXml.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtSvg.so.4.8.2.debug" does not match "/usr/lib/libQtSvg.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtDBus.so.4.8.2.debug" does not match "/usr/lib/libQtDBus.so.4" (CRC mismatch).
Debugging has finished
this is my .pro Configurations [ As U can see I've commented (#) one of two LIBS configs, I just wanted to ask which could be more accurate or more helpful, yesterday i tried and it issued some incompatibility with newer version of libavcodec so I googled some and downloaded libavcodec.53 and configured it but I'm uncertain what should happen now , I'm Now at the moment trying to get the opencv-qt-for-all package from ccr community repository and let the program handle these issues by it self, but I'm sure it won't fix my problem] :
QT += core
QT -= gui
TARGET = FirstOpenCV
CONFIG += console
CONFIG -= app_bundle
CONFIG += link_pkgconfig
PKGCONFIG += opencv
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/opencv2/
#LIBS += -L/usr/local/lib/ \
#-libopencv_core.so \
#-libopencv_highgui.so \
#-libopencv_imgproc.so \
#-libopencv_features2d \
#-libopencv_calib3d.so
LIBS += /usr/lib/libopencv_core.so \
/usr/lib/libopencv_highgui.so \
/usr/lib/libopencv_imgproc.so \
/usr/lib/libopencv_features2d.so \
/usr/lib/libopencv_calib3d.so \
/usr/lib/libavcodec.so
And here's The Code :
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main() {
// read an image
Mat image = imread("002.jpg");
// create image window named "My Image"
namedWindow("My Image");
// show the image on window
imshow("My Image", image);
// wait key for 5000 ms
waitKey(5000);
return 0;
}
Try:
QT += core
QT -= gui
TARGET = FirstOpenCV
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/opencv2/
LIBS += -LC:/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_features2d \
-lopencv_calib3d
It seems it fails on your LIBS declaration.
Can you try this:
LIBS += -LC:/usr/local/lib/ \
-libopencv_core.so.2.4.2 \
-libopencv_highgui.so.2.4.2 \
-libopencv_imgproc.so.2.4.2 \
-libopencv_features2d.so.2.4.2 \
-libopencv_calib3d.so.2.ss4.2
Please notice the backslashes at the end of the lines. Without those, the next line is parsed as a separate declaration and "-libopencv_core.so.2.4.2" by itself is not a valid declaration.
I've never seen using C:/ on Unix: then this could be a required correction (also accounts for #enderland answer):
LIBS += -L/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_features2d \
-lopencv_calib3d
I had some problem on my system when upgraded to OpenCV 2.4.2 - The runtime was bound to previous version, bundled with the OS. I had to (painfully) recompile and reinstall OpenCV, and in the way I found a nice 'trick': use pkgconfig instead of hard coding the paths:
CONFIG += link_pkgconfig
PKGCONFIG += opencv
the problem is solved , as i said before , my program executed but with an error the problem was the Picture Directory, i've put it in the source file beside main.cpp the problem is that if u want to get a real result Using Debug Or Release Mode u should actually put the picture in those two directories and then run Make another time.
If u are willing to run it through the same directory that i used which was the source file, u should open an terminal or just press F4 in ur Dolphin File Manager or whatever u use and first run qmake then call the make and u are good to go, another problem was my OS (chakra) won't let mounted devices to have an Executable Permission so u have to move ur project to Home or Where ever u prefer inside the environment of ur OS.
SOLVED...:) Tnx every one:)

compiling maya (3d application ) with qt

including the maya ( 3d application ) classes in qt program gives lot of errors..... i have added all required include paths and libs...the same problem persists ....
this is pro file for my qt project
TARGET = FileCon
TEMPLATE = app
SOURCES += main.cpp \
dialog.cpp
HEADERS += dialog.h \
ConvertFunction.h
FORMS += dialog.ui
LIBS += "C:/Program Files/Autodesk/Maya2008/lib" \
-lOpenMaya.lib \
-lFoundation.lib \
-lOpenMayalib
INCLUDEPATH += "C:/Program Files/Autodesk/Maya2008/include"
DEFINES = _BOOL \
WIN32 \
REQUIRE_IOSTREAM
///////////////////////////////////////////
How is it possible to use maya classes with qt.
Try something like this
LIBS += $$quote(-LC:/Program Files/Autodesk/Maya2008/lib) \
-lOpenMaya \
-lFoundation
qmake LIBS variable
If you are using QtCreator with the included compiler on Windows, it expects ".a" style libraries, rather than Visual Studio ".lib" style libraries.
You still haven't given enough infromation about eaxctly what you are doing. (How are you building, what compiler, etc.) or what is going wrong (exact error messages) to know for sure if that's the issue. But, if my crystal ball is working well today, I'd recommend checking the library format.

Resources