Teshtek Teshtek - 1 month ago 6
C Question

The equivalent of "./" in windows is ".exe" extension?

I'm running in windows and I want to know what is the equivalent of ./my_program in windows?
For example if I compile a file in c with gcc, something like

gcc my_program.c -o my_program


The I 've to launch it with
./my_progrm
in Linux,but in windows?

If I compile this :
gcc my_program.c -o my_program
, after I can't launch, I have to compile in that way :
gcc my_program.c -o my_program.exe


I'm using minGW

Thank you

Answer

./ is not an instruction to execute a program in Linux, but the path to the program to execute. Actually, ./my_prog means I want to execute le 'my_prog' program in the current directory (.), but you can also do ../my_dir/my_prog or anything else.

When you do ls -l, the shell understand /bin/ls -l.

In windows, if you are in the same directory as your .exe, you don't need to provide the path, just do my_program.exe

Actually, the executables files for Linux are binary files and they don't have any extension, but in windows it is .exe