Yes, it's possible. Here is a link to my answer for the same thing with Cygwin GCC. It works for g++ too.
By telling the linker how to name its output.
$ echo -e "#include <iostream>\nclass myClass { public: myClass() {
std::cout << \"Hello here is my class.\\\n\"; } };\nint main(int nbargs, char *args[]) {
myClass *myInstance = new myClass();
}" | g++ -pipe -x c++ - -Wl,-oess2
This will produce an ess
PE32 / PE32+ executable file, not a ess.exe
.
The -pipe
option instructs the GCC build chain to not write temporary files but use pipe between stages instead. The -Wl,-o
option inhibits the default --force-exe-suffix
.