Results 1 to 4 of 4

Thread: use process to start an external makefile

  1. #1
    Join Date
    Dec 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default use process to start an external makefile

    Hi All,
    I'm using Qt to call various makefiles on my Linux Ubuntu system just to automate some projects. From my reading I think I need to use process start but for some reason I can't get it to work. I know my paths ect are correct because I can use system to get make to work on a program. So in a folder I have a number of makes, SimMakefile, ArmMakefile, Linuxmakefile. Which I normally get to compile via terminal using for example "make -f SimMakefile"
    So in Qt I tried
    Qt Code:
    1. /*lets compile a game*/
    2. directory.setCurrent( "/home/tony/Dropbox/Development/Projects/Games/TankBattle" );
    3. /*just to test*/
    4. QDir output;
    5. QString newpath = output.currentPath( );
    6. game_path = "make -f SimMakefile" ;
    7. process.start( game_path );
    To copy to clipboard, switch view to plain text mode 
    however if I replace process start and setcurrent with linux system calls it works.

    Qt Code:
    1. system("cd /home/tony/Dropbox/Development/Projects/Games/TankBattle");
    2. system("make -f SimMakefile");
    To copy to clipboard, switch view to plain text mode 

    I've tried make as /usr/bin/make with no luck.

    Can anyone advise how I should do this in Qt rather than use system calls.
    Thanks

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use process to start an external makefile

    Change line 2 to :
    Qt Code:
    1. process.setWorkingDirectoryt( "/home/tony/Dropbox/Development/Projects/Games/TankBattle" );
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: use process to start an external makefile

    And I would suggest to pass the program and its arguments separately

    Qt Code:
    1. process.start("make", QStringList() << "-f" << "Makefile");
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  4. #4
    Join Date
    Dec 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: use process to start an external makefile

    Thankyou both got it. Getting to grips with Qt is a bit tricky the API is huge!

Similar Threads

  1. Unable to start linux process by Qt
    By karankumar1609 in forum Qt Programming
    Replies: 3
    Last Post: 19th December 2013, 10:34
  2. Deployment and external process question...
    By scott_hollen in forum Qt Programming
    Replies: 2
    Last Post: 16th December 2011, 19:51
  3. QGraphicsView : paint from an external process
    By bunjee in forum Qt Programming
    Replies: 0
    Last Post: 4th September 2010, 12:01
  4. Replies: 5
    Last Post: 13th March 2010, 14:03
  5. The Gdb process failed to start.
    By been_1990 in forum Qt Tools
    Replies: 3
    Last Post: 29th April 2009, 17:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.