C ++ G ++のコンパイル複数のファイル

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 ビュー30000 +

おすすめ

転載: blog.csdn.net/fbher/article/details/101111180