How to compile C program on command line using MinGW?

前端 未结 14 1123
天命终不由人
天命终不由人 2021-01-30 17:19

What command does one have to enter at the command line in Windows 7 to compile a basic C program?

Like I am literally wondering what you type in the command prompt, to

14条回答
  •  难免孤独
    2021-01-30 17:58

    Instead of setting the %PATH% you may enter your msys shell. In standard msys and mingw installation gcc is in path, so you can run gcc or which gcc.

    I have a batch file sh.bat on my Windows 7, in %PATH%:

    C:\lang\msys\bin\sh.exe --login %*
    

    Whenever I want to use gcc I enter cmd, then sh, then gcc. I find it very convenient.

    When working with linux originated software avoid spaced directories like Program Files. Install them rather to Program_Files. The same regards to tools that you may want to run from msys environment.

提交回复
热议问题