0
我想從一個項目中創建一個.dll和.lib,以便我可以從一個不同的項目鏈接到它,但我實際上生成DLL和lib。我試圖從MSDN很普通的例子:visual c + + 2008:沒有.dll和.lib文件生成
//header
namespace MathFuncs
{
class MyMathFuncs
{
public:
// Returns a + b
static __declspec(dllexport) double Add(double a, double b);
// Returns a - b
static __declspec(dllexport) double Subtract(double a, double b);
// Returns a * b
static __declspec(dllexport) double Multiply(double a, double b);
// Returns a/b
// Throws DivideByZeroException if b is 0
static __declspec(dllexport) double Divide(double a, double b);
};
}
//身體 的#include 「MathFuncs.h」 的#include
using namespace std;
namespace MathFuncs
{
double MyMathFuncs::Add(double a, double b)
{
return a + b;
}
double MyMathFuncs::Subtract(double a, double b)
{
return a - b;
}
double MyMathFuncs::Multiply(double a, double b)
{
return a * b;
}
double MyMathFuncs::Divide(double a, double b)
{
if (b == 0)
{
throw new invalid_argument("b cannot be zero!");
}
return a/b;
}
}
我給自己定的配置類型從屬性到動態庫(.dll)。但是當我構建項目時,我得到的唯一結果是:BuildLog.htm,MathFuncs.obj,mt.dep,MathFuncs.dll.intermediate.manifest,vc90.idb,vc90.pdb。我不知道我錯過了什麼,有人可以幫我嗎?謝謝。
使用合適的項目模板:Win32項目。選擇DLL。 – 2010-12-03 20:19:05