Alex Rivera | Logout

Default file extension of the executable created by g++ under Cygwin vs Linux

Asked 2008-12-11T15:26:49.800
9

I've done most of my work on VisualStudio and don't have much experience with gcc or g++. When I tried to compile a (ex. aprogram.cpp) this morning on my pc using cygwin, I got (aprogram.exe) when I tried to compile the same thing on my Ubuntu box I got (aprogram) w/o any extension. I am just wondering if someone be kind enough to tell me why. This question is just out of curiosity. :)

EDIT: (from Jimmy's comment) g++ under Cygwin defaults to .exe

Edit
Report

1 Answer

2

If you want the output to have an .exe extension then just use the -o flag to do so (e.g. -o aprogram.exe). It will work just fine under linux either way.

The ability to execute a program under linux is based on the file's permissions (see chmod). Execute permissions will be automatically set by gcc/g++.

answered 2008-12-11T15:40:32.190

Your Answer