Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i have generated .exe file from C file (ie filename.c ) after compiling in linux machine with -O option. I wish to know about how to run that .exe file when linux system starts up ?

share|improve this question

migrated from stackoverflow.com Apr 9 '10 at 3:25

This question came from our site for professional and enthusiast programmers.

    
Which Linux distro are you using? –  Aman Jain Apr 6 '10 at 6:12
2  
What do you mean .exe file? Did you compile this for Windows? Can you compile it for Linux? –  R. Martinho Fernandes Apr 6 '10 at 6:13
    
Which Linux distro are you using? Please elaborate what all things you tried, what did not work, etc.? You will get better answers and in less time :) –  Aman Jain Apr 6 '10 at 6:18
    
exe file and linux in one sentence still is somehow a wtf-moment :D –  knittl Apr 7 '10 at 12:25

3 Answers 3

Compile filename.c under linux and just add the command to /etc/rc.d/rc.local. This would get executed when computer boots. Another way would be to create a script for it in /etc/rc.d/init.d/ and then make links to it in the relevant run levels /etc/rc.d/rc3.d/, /etc/rc.d/rc5.d/

share|improve this answer
    
I'd suggest rc.local for the initial try - its simpler especially in light of new dependency based init.d systems, such as upstart. –  Yann Ramin Apr 6 '10 at 6:19

To run exe files on Linux you need Wine.

So first you have to start wine, and then your exe. I guess you have to put these into /etc/rc.d/(Choose appropriate run level)

share|improve this answer
    
Yes, i tried this, but didnt work. –  sagar Apr 6 '10 at 6:14
1  
If you have access to the source code (i.e. filename.c), you should rebuild the program on Linux rather then using Wine. –  R Samuel Klatchko Apr 6 '10 at 6:36

Hi, i have generated .exe file from C file (ie filename.c ) after compiling in linux machine with -O option

I am assuming you are using GCC and you mean '-o' instead of '-O'. In this case you have named the file to be "file.exe", although on Linux you don't need to specify the file extension as "exe".

So you have done something like

gcc filename.c -o file.exe

You can then run the program using

./file.exe

If you would like to have the compiled application run at startup, you will need to put the compiled file in a common location and investigate which startup scripts run for your distribution (init.rc). You may find this helpful.

Once you have found how to add a startup script then you can add /var/myapp/test.exe to an existing startup script or write your own.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.