I am new to Qt so I follow a tutorial on QML. It starts with a basic qml file which should be run with qmlviewer.
The problem is that when I start qmlviewer it says
qmlviewer: could not exec '/usr/lib/qt/bin/qmlviewer': No such file or directory
whereis qmlviewer tells me that it's location is /usr/bin/qmlviewer so I try to run it with this absolute path, but I still get the same error
qmlviewer: could not exec '/usr/lib/qt/bin/qmlviewer': No such file or directory
Why is it still looking for that location ? How can I solve this ?
I should mention that I have tried qtconfig just for testing, and I still get the error, so this is a global Qt problem.
Thank you
As said in the documentation : http://doc.qt.io/qt-5/qtquick-porting-qt5.html
The qmlviewer tool provided for prototyping and testing QML
applications in Qt 4.x has been replaced with the qmlscene tool which
integrates with the new scenegraph features in Qt 5.
So using qmlscence all works.
Related
I am trying to install a C++/Qt/Qml program with CMake. I tried the IFW generator, but I'd rather stick to NSIS64.
Setup install file is correctly generated, and program is correctly installed. But my installed Qt program crashes right away, because
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
It is an easy to solve problem when running the program from the command line: we just need to set QT_QPA_PLATFORM_PLUGIN_PATH to the current directory (I installed/copied qwindows.dll there).
It is strange that the .exe does not look into the current program directory for Qt plugins. Anyways, a way to solve my problem would be: how to set an environment variable in a shortcut .lnk (created by NSIS)?
I have tried a bunch of things with NSIS (added in NSIS.template.in):
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\#CPACK_NSIS_DISPLAY_NAME#.lnk" "QT_QPA_PLATFORM_PLUGING_PATH=$INSTDIR\bin $INSTDIR\bin\#CPACK_NSIS_DISPLAY_NAME#.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\#CPACK_NSIS_DISPLAY_NAME#_cmd.lnk" \
"C:\Windows\System32\cmd.exe" "/c SET QT_QPA_PLATFORM_PLUGING_PATH=$INSTDIR\bin && start $INSTDIR\bin\#CPACK_NSIS_DISPLAY_NAME#.exe"
but this does not compile.
Maybe there is a different way to achieve this. Even if that would work, I would like to avoid setting QT_QPA_PLATFORM_PLUGING_PATH globally during the install, if possible, and restrain it to the program launch.
NOTE: documentation says:
CreateShortcut "$SMPROGRAMS\My Company\My Program.lnk" "$INSTDIR\My Program.exe"
"some command line parameters" "$INSTDIR\My Program.exe" 2 SW_SHOWNORMAL
ALT|CONTROL|SHIFT|F5 "a description"
but I am not too sure about how to use this in my case.
I am trying to set up Marble to work with Qt 5.5 on OSX. I'm not very experienced with the details of linking and such and I think that is causing the problem I am having.
Question: Did I screw up the 'marble` install or is this an easily solved linking issue?
Qt 5.5 is installed in my user directory (using Qt's network installer) on a system running OSX 10.9.5. It works fine. I followed the instructions on the Marble site to clone, build and install from source with (I believe) the appropriate Qt flags. That seemed to go without issue. When I try to build the simple test app listed here, the #include <marble/MarbleWidget.h> line gives a "file not found" error.
After the install I've ended up with the following:
A "marble" directory in my root user folder
A "Marble.app" file along with various other marble related files in the bin and include directories. However the Marble.app gives the following error on launch:
Dyld Error Message: Library not loaded:
#rpath/QtCore.framework/Versions/5/QtCore Referenced from:
/usr/local/Marble.app/Contents/MacOS/marble-qt Reason: image not
found
Binary Images:
0x7fff6a1f9000 - 0x7fff6a22c817 dyld (239.4) <7AD43B9B-5CEA-3C7E-9836-A06909F9CA56> /usr/lib/dyld
So a semi-solution: I used the Qt Creator "add Library" function and ended up with the following additions to the .pro file. I had to paste in the link to the lib since the dialog doesn't allow browsing of "usr/local/". Also, although I tried to link to the lib alias ("libmarblewidget-qt5.dylib"), the actual lib name is used.
macx: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lmarblewidget-qt5.0.21.80
INCLUDEPATH += $$PWD/../../../../../usr/local/include
DEPENDPATH += $$PWD/../../../../../usr/local/include
I don't understand what this $$PWD/../../../../../ business is.
But it worked and I am able to run the example code at the link in my question.
I wish this install/build stuff wasn't so damned arcane. I've spent endless hours just trying to get things set up – really sucks the joy out of exploring this stuff and I can't say I really learned much of anything from it.
Update
So I cleaned out the "$$PWD" crap and the literal lib name and it works. Not sure what difference it makes – but there you go.
macx: LIBS += -L/usr/local/lib/ -lmarblewidget-qt5
INCLUDEPATH +=/usr/local/include
DEPENDPATH +=/usr/local/include
Either the build is faulty or you need a different version of Qt installed to run it. Usually the app has the Qt libraries that it needs wrapped up in the app itself. If it's not in there it will search your mac for it. The message says that QtCore can't be found in either place. If you look inside Google's Google Earth, you can see where the libraries are stored. You can also copy a version of QtCore into your Marble to see if it will work.
I created a C++ library project in Qt creator. After building the project I have the libMylib.so, .so.1, .so.1.0, .so.1.0.0, Makefile and mylib.o files. I added the library headers to my other project and added the path to my .pro file like this:
LIBS += "/home/peter/Workspace/build-Libtester-Desktop-Release/libMyLib.so"
When building the application I don't get no such file error, but when running it I get this:
/home/peter/Workspace/build-Libtester-Desktop-Debug/Libtester: error while loading shared libraries: libMyLib.so.1: cannot open shared object file: No such file or directory
which I can't understand, because it's right there next to the .so which it seem to find, because when the path is wrong I get a no such file or directory error when trying to build the project.
Could someone explain what I'm missing here?
Thanks for your time.
Fortunately, your problem has nothing to do with both Qt and Qt Creator. The error simply boils down to how shared libraries are searched by LD for dynamic linking on Unix OS family.
Today, I've answered similar question, have a look, please. This question was asked in regard to Mac OS X. However, Linux and Mac OS X are the same in the context of your problem. I've provided additional explanation for Linux at the bottom, so pay attention to it. "it's right there next to the .so" - you seem to have Windows background if you make this assumption, but it is wrong for Unix OS family altogether (as stated in the answer too). If you have further questions, just ask.
You are adding the library incorrectly. You are doing:
LIBS += "/home/peter/Workspace/build-Libtester-Desktop-Release/libMyLib.so"
instead of:
LIBS += -L"/home/peter/Workspace/build-Libtester-Desktop-Release" -lMyLib
The first version works on windows, but not linux.
Basically, you create a library, which will be named "libMyLib.so", and then you specify the path to its folder, prepended by "-L" and then do "-lMyLib" at the end, note that it's not "-llibMyLib", but just "-lMyLib", despite the fact that the .so name is "libMyLib".
Look here: https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application for more info.
So I have installed the QtSDK on my Windows 7 64 bit machine. However, it seems like when I try to run a simple program like hello world such as:
#include <iostream>
int main(....) {
std::cout << "Hello World\n";
}
My program first gets the error:
CreateProcess: No Such file or directory.
So what I did was I went to this link here:
http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista
And I first tried to add the directory to the
PATH: C:\MinGW\libexec\gcc\mingw32\MinGW-Version
(my directory is slightly different but follows same idea)
where MinGW-Version is the Version of MinGW you are using
So now that got rid of that error but now I get the error:
iostream: No such file or directory
So now I add the path where the iostream library is and that fixes that error but then I get all these other errors where it can't find other standard C++ libraries such as stddef.h or stdio.h etc. So it seems as if the C++ libraries cannot be linked to. I have tried various other things such as including C:\MinGW\bin in my path and have tried uninstalling and reinstalling Qt. Also I have checked that Qt is using the right gcc compiler by going to Tools->Options->Toolchains in Qt Creator.
It seems that the linking to C++ libraries is not correct for some reason. Could anyone help me or guide me as to why this may be happening and how to fix this?
I'm not sure why it's not working, so I'll just tell you how my environment is set up. I don't think you need to add any library paths to the system path. You should only need to add C:\MinGW\bin.
So get rid of everything except for that. Also, are you setting this through cmd or control panel? If doing it in the control panel, make sure you are putting it in the "Path" variable not "PATH" -> the former is in the lower box. I've had problems before using "PATH" in the upper box - not sure what the difference is to be honest.
The QtSDK installation usually install the mingw compiler for you in ...\QtSDK\mingw. The libraries and dlls in ...\QtSDK\Desktop\Qt\4.7.3\mingw were compiled with this compiler. The mingw compiler you installed to c:\MinGW may be a different version than that. If you want to use this compiler you would have to recompile the Qt libraries.
C++ librairies in Qt.
Go to this URL http://doc.qt.digia.com/qtcreator-2.4/creator-overview.html for how to.
It seems (I did not try it, yet) that other librairies can be easily linked to a Qt Project.
This could solve the problem.
Pythagooric
I am trying to build a Qt GUI Main Window project and get the following errors:
BLDMAKEERROR:Can't find "\Symbian....\BLD.INF
bldmake returned with exit value=1
In the last two days, I've re-installed above apps many times following all
installation guides; setting up the environment variables but nothing worked
out.
Kindly anyone help as I've been able to build even the Helloworld program.
Thanks in advance.
bld.inf gets generated by qmake from your .pro file. Have you run qmake on your project? In Carbide.C++ Qt perspective it's Project->Run qmake.
I got the same problem even w/o Qt and qmake. :( The problem is in the IDE: it generates wrong bld.inf! If you open folder "group", which contains bld.inf, you'll see the Icons_aif_scalable_dc.mk file, but in bld.inf it configured as
PRJ_MMPFILES
gnumakefile icons_scalable_dc.mk
And this is the source of the problem, so after changing icons_scalable_dc.mk on Icons_aif_scalable_dc.mk project will be built as it should.