g++编译多个c++文件

ma.cpp

#include<iostream>
#include "t.hpp"
using namespace std;
int main()
{
	node a;
	a.f();
	return 0;
}

t.hpp

#ifndef __THREAD_POOL_H
#define __THREAD_POOL_H
struct node{
	void f();
};
#endif

t.cpp

#include "t.hpp"
#include<iostream>
using namespace std;
void node::f()
{
	cout<<"the fucking world"<<endl;
}

命令:g++ ma.cpp t.cpp -o ma

发布了133 篇原创文章 · 获赞 8 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/fbher/article/details/101111180