Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I stop gcc under Cygwin from adding ".exe" to compiled executables?
    primarykey
    data
    text
    <p>I would like to know how I can prevent gcc under Cygwin from automatically adding the .exe extension to compiled files, because I just caused myself a lot of confusion with "missing files". For context, I am working on a C project for university and I usually work in the labs which run Ubuntu (dual-boot with Windows), but to work from home I prefer using my Windows machine, ergo Cygwin. If I just remove the extension it still works just fine on either system, but it is rather frustrating to have to change the command to include the extension whenever I've just compiled it under Cygwin.</p> <p>I looked up the FAQ from Cygwin to find that it is probably an issue related to an environment variable in .bashrc or .bash_profile (<a href="http://cs.nyu.edu/~yap/prog/cygwin/FAQs.html#bashrc" rel="nofollow noreferrer">see here</a>), but I am no command-line ninja and am not very familiar with editing configuration files... I found two related questions as well that show the same behaviour, but have nothing to do with trying to change it:</p> <p><a href="https://stackoverflow.com/questions/1475684/compiling-with-gcc-cygwin-on-windows">Compiling with gcc (cygwin on windows)</a></p> <p><a href="https://stackoverflow.com/questions/4143629/executable-file-generated-using-gcc-under-cygwin">Executable file generated using gcc under cygwin</a></p> <p>Any ideas?</p> <p>EDIT: It is actually for an MPI in C project so I have a Makefile that calls mpicc but that is not really relevant to the problem, since I just tried with gcc as well and both do the same thing. For the purpose of this question, the commands and outputs I get are:</p> <pre><code>$ gcc -o hello hello.c $ ls hello.c hello.exe $./hello Hello, world! $./hello.exe Hello, world! </code></pre> <p>Note that running with or without the extension does the same thing in the shell, but it does not with mpirun which is why I want to change this behaviour.</p> <p>EDIT: I eventually decided that Windows is not the programming environment for me. From now on all work that can be done in Linux will be. Thanks all.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload