PDA

View Full Version : Starting a second executable using system( )



emp1953
23rd March 2020, 15:09
I am on RHEL6 Linux QT4.8 QtCreator 2.8.1. My system call is as follows:

system ( "/home/mydir/build-FlashRad-Desktop-Debug/FlashRad ");

FlashRad is the executable

From a command line When I cd into /home/mydir/build-FlashRad-Desktop-Debug and type ./FlashRad it runs the app.

But from the calling app I get the error that the director/file does not exist.

Is my system syntax wrong? Thanks for any help

emp1953

Lesiok
23rd March 2020, 16:32
What happens when you do from the command line : /home/mydir/build-FlashRad-Desktop-Debug/FlashRad without cd ?

emp1953
23rd March 2020, 17:27
What happens when you do from the command line : /home/mydir/build-FlashRad-Desktop-Debug/FlashRad without cd ?

starting out in my home directory it runs the app without errors. I can cd to any directory and type in /home/mydir/build-FlashRad-Desktop-Debug/FlashRad and again
it runs the app without errors.

I even created a script file that cd's to the correct directory then tries to run with ./FlashRad

The error now says that my script cannot be found.
But its there and I can executed it from the command line. All permissions are wide open 777

Added after 6 minutes:

Ok, I got it to work but I don't know why. I built the FlashRad project from the command line so that the project executable was placed in the FlashRad project directory. When building/running from qtCreator it puts the executable in the build-FlashRad..... directory. If I run from the executable in the project directory all works as expected and the app in the system call starts up, but if I run from the build directory it does not work as expected.