安装mingw后,在命令窗体编译c文件

1、编译test.cpp文件


#include<iostream>
int main(int argc,char **argv)
{
  std::cout<<"hello"<<std::endl;
return(0);
}
2、在cmd模式下进入test.cpp文件夹


3、编译。将.cpp文件生成目标文件
g++ -c test.cpp


4、链接,将目标文件生成可运行文件
g++ -o test test.o


编译test.c文件


#include<stdio.h>
int main(int argc,char **argv)
{
  printf("hello");
return(0);
}
gcc -c test.c


gcc -o test test.o



在ccd 键入mingw-get 进入MinGW Installation Manager 窗体


 download and install the C compiler from the command line:  mingw-get install gcc

























原文地址:https://www.cnblogs.com/blfbuaa/p/7256012.html