Results 1 to 10 of 10

Thread: Run console application directly from directory using double click

  1. #1
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Run console application directly from directory using double click

    Hi,

    I have a simple console application and when I compile and run in Qt Creator it works fine, when I run it from terminal ( Ubuntu ) it works fine but when I try run it directly from directory using double click it doesn't work - nothing happens.

    But GUI application ( using widgets ) I can run directly from directory using double click...

    Maybe someone know what I am doing wrong?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Run console application directly from directory using double click

    Most likely cannot find the libraries it depends on.

  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: Run console application directly from directory using double click

    What does the program do?
    I.e. how did you determine that it did not run?

    Cheers,
    _

  4. #4
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Run console application directly from directory using double click

    This application doesn't do anything - it is a simple example for console application.

    I.e. how did you determine that it did not run?
    Because I don't see the console.

    I am suprised that the gui application without all dependency works fine...
    But ok, I will try to copy to directory all dependency and then see if it works.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Run console application directly from directory using double click

    Quote Originally Posted by atomic View Post
    Because I don't see the console.
    Why would you? Programs do not open terminals on their own.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    atomic (1st February 2015)

  7. #6
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Run console application directly from directory using double click

    Thanks Wysota,
    I just starting with linux system and I thought that console application I can run equivalent how in windows.

    Update:
    I wrote bash script which can run my console application

    #!/bin/bash
    gnome-terminal -e "./name_of_my_app"
    and in file properties I check - allows the file to be executed.

    Now it works fine.
    Thanks one more time.

  8. #7
    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: Run console application directly from directory using double click

    Quote Originally Posted by atomic View Post
    This application doesn't do anything - it is a simple example for console application.
    If it does nothing, it is difficult to know if it has run at all.
    Not that it matters, because it wouldn't have done anything anyway

    Since your other programs work I would just assume this one does as well and just does what it is supposed to do: nothing

    Quote Originally Posted by atomic View Post
    I just starting with linux system and I thought that console application I can run equivalent how in windows.
    You can.
    If the program does nothing, then it won't do anything on Windows either.

    Quote Originally Posted by atomic View Post
    I wrote bash script which can run my console application
    and in file properties I check - allows the file to be executed.

    Now it works fine.
    It is like that it also worked fine before.
    But since "working" means not doing anything it is nearly impossible to determine whether running it in a terminal changed anything.

    You should really implement some functionality that affects the system in some way, e.g. writing a file, before you determine that it does indeed not run when launched directly.

    Cheers,
    _

  9. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Run console application directly from directory using double click

    In my experience, running even a "do-nothing" program on Windows (up to and including Win 7) by double-clicking the file name will at least briefly post an MS-DOS command window. Maybe this is happening too quickly to be noticed or the window is behind others, but I am certain that it is still happening. One way to test would be to simply add a sleep() statement with a few seconds' delay to main().

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Run console application directly from directory using double click

    Quote Originally Posted by d_stranz View Post
    In my experience, running even a "do-nothing" program on Windows (up to and including Win 7) by double-clicking the file name will at least briefly post an MS-DOS command window. Maybe this is happening too quickly to be noticed or the window is behind others, but I am certain that it is still happening. One way to test would be to simply add a sleep() statement with a few seconds' delay to main().
    It depends whether the program has the console activated or not.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Run console application directly from directory using double click

    It depends whether the program has the console activated or not.
    Well, yes. I don't know if I have ever written a non-GUI app that didn't include console activation. I suppose servers / services would not ordinarily activate a console. In Visual Studio at least, it takes a little bit of effort to create a non-console, non-GUI app.

Similar Threads

  1. Replies: 4
    Last Post: 11th January 2014, 03:06
  2. Restore application on dock icon double click
    By mentalmushroom in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2013, 16:03
  3. Telling apart single click and double click in QTableView
    By jgirlich in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2013, 14:27
  4. Replies: 2
    Last Post: 16th July 2012, 12:40
  5. Replies: 2
    Last Post: 11th January 2009, 23:24

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.