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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章