参考
http://www.cnblogs.com/skynet/p/3372855.html
编译命令
1.静态库
源文件StaticMath.cpp
#include "StaticMath.h"
#include <iostream>
using namespace std;
void StaticMath::print()
{
cout<<"123";
}
StaticMath.h
#pragma once
class StaticMath
{
public:
// StaticMath(void);
// ~StaticMath(void);
// static double add(double a, double b);//加法
// static double sub(double a, double b);//减法
// static double mul(double a, double b);//乘法
// static double div(double a, double b);//除法
void print();
};
TestStaticLibrary.cpp
#include "StaticMath.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
double a = 10;
double b = 2;
// cout << "a + b = " << StaticMath::add(a, b) << endl;
// cout << "a - b = " << StaticMath::sub(a, b) << endl;
// cout << "a * b = " << StaticMath::mul(a, b) << endl;
// cout << "a / b = " << StaticMath::div(a, b) << endl;
StaticMath sm;
sm.print();
// system("pause");
return 0;
}
动态库需要执行以下步骤才可生效,不然找不到此动态库