You can not expect to be able to execute the same commands on both Windows and Linux. They use different shells with different syntax and different behaviors.
Here's a typical example of compiling a file on GNU/Linux:
dir$ g++ myfile.cpp -o myfile
dir$ ./myfile
Here's a typical example of compiling the same file on Windows:
dir> g++ myfile.cpp -o myfile.exe
dir> myfile
Note in particular:
- Linux doesn't use
.exe
or other extensions on executables, but Windows does.
- Windows doesn't require specifying directory to run files in the working directory, but Bash on GNU/Linux generally does.
- The only reason why the compilation command is as similar as it is is that g++ is a Unix tool ported to both platforms. Windows normally uses
/
instead of -
for flags like -o
As commands get more complex, they start diverging even further.