How to compile C program on command line using MinGW?

前端 未结 14 1097
天命终不由人
天命终不由人 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条回答
  • First:

    Add your minGW's bin folder directory ( ex: C\mingw64\bin ) in System variables => Path. visual example


    Compile:

    .c: gcc filename.c -o desire

    .cpp: g++ filename.cpp -o desire


    Run:

    desire/ or ./desire

    0 讨论(0)
  • 2021-01-30 18:11

    Where is your gcc?

    My gcc is in "C:\Program Files\CodeBlocks\MinGW\bin\".

    "C:\Program Files\CodeBlocks\MinGW\bin\gcc" -c "foo.c"
    "C:\Program Files\CodeBlocks\MinGW\bin\gcc" "foo.o" -o "foo 01.exe"
    
    0 讨论(0)
提交回复
热议问题