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

来源:互联网 发布:钢琴演奏软件 编辑:程序博客网 时间:2024/06/05 12:01
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

























1 0