C++静态库和动态库的制作与使用——类级
0.前提(文件内容)
test.h
#pragma once
class Test{
public:
Test();
~Test();
void Func(int i);
};
或
#ifndef __TEST_H
#define __TEST_H
class Test{
public:
Test();
~Test();
void Func(int i);
};
#endif //__TEST_H
test.cpp
#include <iostream>
#include "test.h"
using namespace std;
Test::Test(){
cout << __func__ << "()" << endl;
}
Test::~Test(){
cout << __func__ << "()" << endl;
}
void Test::Func(int i){
cout << __func__ << "(" << i << ")" << endl;
}
main.cpp
.
#include "test.h"
int main(){
Test t;
t.Func(100);