Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess execute a unkown program
QtWS25 Last Chance

QProcess execute a unkown program

Scheduled Pinned Locked Moved General and Desktop
qprocessred pitayacompilation
5 Posts 3 Posters 3.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    grafzahl
    wrote on last edited by
    #1

    Hi,

    i want to execute with QProcess a program (arm-linux-gnueabi-gcc), which Qt doesn't know. I need that for cross-compiling code for a Red Pitaya.

    Terminal:

    • molsyst@molsyst:~$ arm-linux-gnueabi-gcc
    • arm-linux-gnueabi-gcc: fatal error: no input files
    • compilation terminated.
      (program is recognised)

    Qt:

    • QProcess *compile1;
    • compile1 = new QProcess(this);
    • compile1->start("arm-linux-gnueabi-gcc");
    • qDebug() << compile1->errorString();
      Output:
    • Select all"No such file or directory"

    But why does Qt not know a program, which the terminal knows?

    I already asked this question in the RedPitaya Forum ( http://forum.redpitaya.com/viewtopic.php?f=14&t=465&p=1764 ), but i think here it is better placed.

    Thanks in advance
    GrafZahl

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      You have to provide the full path

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vince Golubic
        wrote on last edited by
        #3

        Precisely. Here's a good example that can help.

        http://doc.qt.io/qt-5/qdir.html

        One other thing that can help, as a plan B.

        You can execute a normal Linux process under Qt using the system (" ") call from within Qt -with arguments included in " ", or try:

        Example:
        {
        const char* sys_command;

        sys_command.toLatin1().constData() ;
        system(sys_command);
        }

        1 Reply Last reply
        0
        • G Offline
          G Offline
          grafzahl
          wrote on last edited by
          #4

          Thanks for answers.

          Full path was the solution, now it works fine. 8-)
          I also now use the system command.

          Thanks

          M 1 Reply Last reply
          0
          • G grafzahl

            Thanks for answers.

            Full path was the solution, now it works fine. 8-)
            I also now use the system command.

            Thanks

            M Offline
            M Offline
            mcosta
            wrote on last edited by
            #5

            @grafzahl said:

            I also now use the system command.

            If you can, I suggest to use QProcess to run external commands. This for two reasons:

            1. QProcess is cross-platform (in the future you could want to build your application also on other platforms);
            2. You can have direct access to the standard out/err, ....

            Once your problem is solved don't forget to:

            • Mark the thread as SOLVED using the Topic Tool menu
            • Vote up the answer(s) that helped you to solve the issue

            You can embed images using (http://imgur.com/) or (http://postimage.org/)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved