windows下使用g++命令编译.h文件

xiaoxiao2026-08-25  6

全是试出来的

先下载个 MainGw  http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe

然后在同一个目录中写下边3个文件

编译命令 g++ -o hello add.c main.cpp //具体什么意思我也不清楚  

命令行输入  hello.exe

控制台就输出 hello

 

 

编译成dll好像是这个命令 dllwrap -mno-cygwin -o hello.dll add.h

#include <iostream> using namespace std; void print() { cout<<"hello"<<endl; }

 

void print();

 

#include <iostream> #include "add.h" using namespace std; int add(int,int); int main(){ print(); } int add(int a,int b){ return a+b; }

 

转载请注明原文地址: https://www.6miu.com/read-5051843.html

最新回复(0)