How to make C++/C# files executable on Linux ?

Discussion in 'Programming' started by ActiveFrost, Mar 13, 2009.

  1. #1
    Ok, so - I've made a simple application ( hello world ), and after compiling it with gcc or c++ ( Linux compilers ) I can execute it only from command line ( terminal ).
    I got an exe style file as an output ( after compiling ) but I can't run it with double-click and so on .. it can be launched only in command line !

    What I want to know is - how do I make it executable ? I mean, so I could double-click on it and it will act as a program, not script.

    Thanks for your help,
    ActiveFrost.
     
    ActiveFrost, Mar 13, 2009 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    You need to compile the source on the platform you want to execute it on.
    GCC is availabe for Windows, Linux, MAC OSX and etc. There are also cross compilers available which provide you facility of compiling code for other platforms.

    As far C# it is CLI and it is now proted to said 3 major operating systems. The crossplatform version of .Net is called Mono check here http://mono-project.com/Main_Page.

    regards
     
    Vooler, Mar 13, 2009 IP
  3. MayurGondaliya

    MayurGondaliya Well-Known Member

    Messages:
    1,233
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    170
    #3
    c++ can be executed on linux using GCC. However, C# can not be executed until you have .net frame work for linux or mono project has been completely successful.
     
    MayurGondaliya, Mar 13, 2009 IP
  4. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #4
    Compiled with GCC/C++ ( tried both ) and none of them can be executed ( only from console by typing in ./sample ).
     
    ActiveFrost, Mar 13, 2009 IP
  5. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    If you can run it by typing "./sample" on the command line then it IS executable. You just need to configure your WM to run apps when you double click on them.
     
    lephron, Mar 16, 2009 IP
  6. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #6
    What is "WM" and why to configure ? What I want to do is to make an application which can be executed with single/double click ( let's say if I send it to my friend .. I don't want him to configure his machine to run it ).
     
    ActiveFrost, Mar 16, 2009 IP
  7. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #7
    WM is window manager. By default most WM will allow you to double click an application to run it.
     
    lephron, Mar 17, 2009 IP