Qt application - open one process only
Even if you don't want to, QtSingleApplication
is what works. If you want to learn how it is implemented, you can always read the source code.
Single setup exe file Qt Application deployment
==>Static Compilation for Windows -
https://www.youtube.com/watch?v=lwX_urJJOf8
==>Static Compilation for Mac/Linux -
https://retifrav.github.io/blog/2018/02/17/build-qt-statically/
How to run my application without QTCreator?
When you deploying your app using windeployqt
default is release build, so if you want to deploy the debug version of libs (the ones with 'd' at the end) you have to pass --debug
parameter.
You should never mix programs compiled as Release version with debug libs and Debug version with release libs. Debug libs have some extra code and they're not compatible with each other.
When you use MinGW, you may also need to copy libgcc_s_dw2-1.dll
, libstdc++-6.dll
and libwinpthread-1.dll
from qtfolder/5.9/mingw.../bin
to your exe folder.
Unable to run application outside qt
QtCreator keeps an internal environment path for qt libraries. To run your "HelloWorld.exe" you can just copy missing dlls from qt/bin to the same folder with the executable. A better solution would be adding qt/bin to system path from environment variables.
If you are planning on distributing your application, the best solution is to link qt libraries statically instead of dynamically. You can learn more about his option from:
How to make Qt and Qtcreator link the libraries statically instead of dynamic?
Run another executable in my Qt app
My fault was in the path to executable.
I edit it, very simple and got it work.
QApplication a(argc, argv);
MainWindow w;
w.show();
QProcess P(&w);
QString programPath;
programPath=
"/home/erfan/Documents/Qt/test1-build-desktop- Qt_4_8_1_in_PATH__System__Release/test1";
P.start(programPath);
return a.exec();
And it work properly.
Another way is to put the executable directly in root:
(/ somthings)
opening an exe file in c++ form
Possible some of application components not founded by executable file. For simple case QProcess::setWorkingDirectory( /* executable directory */ ) can help.
In bad case check environment variables of process in your run. You can loss paths to required libraries.
Related Topics
Std::Istream_Iterator<> with Copy_N() and Friends
Getting Actual File Name (With Proper Casing) on Windows
How to Convert a Tchar Array to Std::String
Is It Good Practice to Make Member Variables Protected
Std::Thread - "Terminate Called Without an Active Exception", Don't Want to 'Join' It
C++ 'Strcpy' Gives a Warning (C4996)
Can a C Compiler Rearrange Stack Variables
Best C++ Matrix Library for Sparse Unitary Matrices
What Happens to an Stl Iterator After Erasing It in VS, Unix/Linux
How to Format a Datetime to String Using Boost
What Is a C++11 Extension [-Wc++11-Extensions]
In C++ How Is Function Overloading Typically Implemented
Finding C++ Interval Tree Algorithm Implementation
What Is the Significance of 'Strongly Happens Before' Compared to '(Simply) Happens Before'
Static Initialization and Destruction of a Static Library's Globals Not Happening with G++
Template Specialization for Multiple Types