Application Qt and Qwt won't run from menu - c++

Greetings for the first time:
Usually I can work my way through problems like this but I think I need help for this one.
I have developed a small utility for myself to plot some data using Qt and Qwt under Mint. When I run the application from Qt Creator everything works fine. Once I added (export LD_LIBRARY_PATH="/usr/local/qwt-6.1.3/lib") to my .bashrc file, I can invoke the application from the terminal with “./PlotAccountsChange” and it woks. Also the ldd command shows all dependencies have been found.
The problem I am having is that the application can not be invoked from the Nemo file manager, or from the menu system if I add the link to the executable in the menu, or from a link to the executable placed on the desktop. In all of these cases I get no indication at all, just nothing happens. Any other application that I have created using Qt but that doesn’t use Qwt invokes without problems.
Thank you, regards,
B Kace

Related

Qmake on Windows

I have a project written in Qt that I have no problems compiling and running on Linux. The command line is:
qmake ../trunk/GSDTesting.pro
The process on Linux was really simple: install a few dependencies using apt and you are off.
My task is to recompile the same program on Windows using Visual Studio C++ compiler, but the problem is I don't know how to start. There is no such thing as qmake for Windows.
Can someone give me a few hints where to start. Please note that I don't know QT almost at all, my task is just to debug some issue unrelated to QT.
Are you using terminal exclusively on Windows? If so, maybe this image of example build steps straight from Qt Creater 4.14.2 may help you:
As you can see the image of the default Qt creator build steps list the file path where 'qmake.exe' can be located on a local installation of the toolchain.
If you can use a machine with a display I find using the Qt creator GUI is not all that bad.
Here is a link to the base get started page:
https://doc.qt.io/qt-5/gettingstarted.html
Here is a link to the installer download page:
https://www.qt.io/download
IMPORTANT:
You will need to make a Qt account, login to your account, and then download the open-source version of the API. The commercial version of the same source is acquired differently/seperately.
Otherwise, if you cannot use the GUI, can I request some clarification on why you cannot use Qt creator on your Windows installation?

No output from heob in a Qt application using Qt Creator

I would like to use heob to check my app for memory leaks. This is what i tried: I opened the project "analogclock" from the examples collection in qtcreator. After that i have chosen "Analyze" and "Heob" from the drop down menu. After choosing the heob path and a click on the ok button, the application starts and a console window "heob32" is displayed. But now nothing happens. Just the word "kill" is displayed in the console window. I can´t see any output and if i close the analogclock app i get the message: "heob: cannot create target process". Can anyone help me further to get useful output from heob?
What OS are you using and what heob did you install?
You need to download and install heob separately from Creator. Creator just installs a link without heob itself. Have you done this? Are you really running on a 32-bit system (there is a heob64 in case you are using a modern OS).
Did you configure your heob installation in Qt Creator correctly?
Can you run heob from the commandline with reasonable behaviour?

Cannot run Qt Creator GUI outside of Qt. "The application was unable to start correctly (0xc000007b)" error

I downloaded C++ code from GitHub to tag images for training an object detector using Machine Learning.
Within Qt Creator 4.2.1 Based on Qt 5.8.0 (MSVC 2015, 32bit), I was able to compile and run the code. Unfortunately, I was not able to run the .exe outside of Qt Creator.
Initially, I received an error that
"The program can't start because libgcc_s_dw2-1.dll is missing".
Thanks to
QT The program can't start because libgcc_s_dw2-1.dll is missing, that was fixed easily by adding
"QMAKE_LFLAGS += -static"
to the .pro file. Now, when I run it I get
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
I was able to reproduce the error using the simple "Hello World" default project that appears when you create a Qt Widget Application. This led me to believe something was wrong with my installation.
Based on the advice of this article: https://stackoverflow.com/questions/12099117/32-bit-qt-application-on-win-7-x64-wont-run-but-runs-fine-from-qt-creator, I used Dependency Walker to identify possible causes. I expected to see only a few items that I can follow up on. Instead, I received a list of close to 100 missing .dll files. All the files started with
"API-MS-WIN ###.DLL" or "EXT-MS ###.DLL"
where ### represent some additional text characters, for example;
"API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL"
I'm attaching a sample output.
Another suggestion was to copy over
libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll.
That did not work either.
My next move was to simply get the latest version of QT and wish for the best. I installed Qt Creator 4.8.1 Based on At 5.12.0 (MSVC 2015, 32 bit). This time, I could not even get the code to run in the IDE. I received 1000+ error messages!
Based on advice from several pages, I added
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
to the .pro file and it still would not compile.
Also, I verified that the application is being built as a 32bit application. I'm running on a 64 bit Windows 10 system.
If anyone would like to take a crack at it to see if they can create a working .exe, here is the link: github.com/clavicule/BBTag
Qt provides a tool to copy the necessary dlls to the folder of your executable.
The tools is called windeployqt.exe and comes with your Qt installation. For me it is located at C:\Qt\5.9.1\msvc2015_64\bin\windeployqt.exe. You will have to look at your installation path and probably the msvc_32 folder to find it.
Then you go to the folder with your executable in it, oben a command prompt or powershell and execute path\to\windeployqt.exe yourProgram.exe and it will automatically copy the necessary dll files to this folder. Afterwards you can run your program without issues.
The official documentation for the tool can be found here.
Alternative 1: While developing you could use QtCreator which automatically adds the paths to the dlls when running your program - make sure to include them if you deploy your program!
Alternative 2: Add the path to the necessary dlls to your PATH variable. This isn't recommended either, since everyone who gets your program would have to do the same to run it.
I figured it out! My installation of Anaconda (a Python distribution popular for data science and machine learning) is the culprit.
From: #remy-lebeau
The application was unable to start correctly (0xc000007b)
The error:
"The application was unable to start correctly (0xc000007b) ..."
is a good indicator that the 32-bit app tried to load a 64-bit DLL. At first, this did not make sense since I verified many times that I was using the 32 bit version of Qt.
It turns out that the installation of the 64 bit version of Anaconda also contained many Qt5 dlls used for the PyQt5 package. Since the path to this folder came before the path to my c:\Qt...\bin folder, it was used in the build instead of the actual 32 bit version installed with Qt. This was not obvious because I was unaware of PyQt5 so I had no idea that it came with Anaconda. A simple reordering of the path entries using the System Environment Variables interface AND a system restart fixed the problem.
Silver lining: I now know C++ and designing GUIs w/ QT and PyQt5
Thanks #albertmand and #jwernerny

How to make a standalone mac app using qtcreator

I have build an app using C++ and Qt on QtCreator. The result is a .app file.
Now, when I am running it from the Qt Creator it is running fine.
But when I am running it on a different machine (with no Qt installed) it is not running.
I have figured out the reason is because my .app file is not deployed properly (as there is no framework folder added in the .app)
But I am now having trouble solving it. I am following this link but not getting anywhere as it for console purely.
Is there a way I can fix it using Qt Creator?
A Qt application relies upon Qt's libraries, which must be shipped with the application, inside the built application bundle. The steps for deploying a Qt application for OS X are detailed in the documentation.
If you're not using any other libraries, besides those of Qt, you just need to run the tool macdeployqt, which is part of the Qt installation, in the bin directory. You can set this up to run as a build step in Qt Creator, but I suggest only doing it before you actually deploy the final bundle to another machine.
Calling macdeployqt will copy the necessary Qt frameworks into the bundle and setup the paths to the frameworks so that the binary in the bundle knows where to find them.
If you use any other frameworks or libraries, you need to copy those yourself and set the references to them using install_name_tool

QT4 GDB debugger doesn't link to shared libraries on Ubuntu

I'm new to UNIX and QT4 but ubuntu is coming along. My first QT4 project links a simple test app to a shared dll of ported code. I am able to build the application using QT Creator and to run it from the terminal. However the embedded GDB debugger reports: unable to load shared ... no such file or directory.
The .pro file contains the line LIBS += /home/aurel/VISUALAGEPORTS/libVISUALAGEPORTS.so.1.0.0
I was able to revert to a backup version which does run. However, the 1st time I tried to debug the restored version I encountered the same error. The second attempt mysteriously worked with no changes.
Does anyone know why the QT Creator would link correctly and produce an executable that runs from the terminal but not from the embedded debugger?
Thanks for any ideas
You can specify a search path for shared objects via LD_LIBRARY_PATH variable. I'm not sure how to do that from within QT Creator, but if I was running gdb from command line, I'd so something like this:
LD_LIBRARY_PATH=/home/aurel/VISUALAGEPORTS/ gdb path_to_executable.
Give that a go.