为了便于在Windows系统下进行轻量级的C/C++编程;
1.安装MinGW (自动下载gcc);
2.写代码 main.cpp
/*#include<iostream> using namespace std; int main(int argc, char* argv[]) { cout<<"Hello World!"<<endl; return 0; }*/ #include <windows.h> int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { MessageBox (NULL, "Hello World, My Dear", "Hello Demo", MB_OK); return (0); }
3.写makefile 文件
objects = main.o hello : $(objects) g++ -o hello $(objects) -mwindows hello main.o : main.cpp g++ -c main.cpp clean : del *.o
4. make
时间: 2024-10-10 10:24:05