视觉c++ 2008:没有生成 .dll 和 .lib 文件
我正在尝试从一个项目创建一个 .dll 和 .lib ,以便我可以从另一个项目链接到它,但我在实际生成 dll 和 lib 时遇到了麻烦。我尝试使用 msdn 中的非常一般的示例:
//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);
};
}
//body #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。我不知道我错过了什么,有人可以帮助我吗?谢谢。
I am trying to create a .dll and .lib from a project so that I can link to it from a different project, but I am having trouble actually generating the dll and the lib. I tried with the very general example from msdn:
//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);
};
}
//body
#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;
}
}
I've set the configuration type from properties to Dynamic Library (.dll). But when I build the project, the only output I get is: BuildLog.htm, MathFuncs.obj, mt.dep, MathFuncs.dll.intermediate.manifest, vc90.idb, vc90.pdb. I don't know what I am missing, can someone help me out? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该 dll 一直被输出到 $OutDir/$ProjectName.dll 指向的目录。
The dll was being outputted to a directory pointed by $OutDir/$ProjectName.dll the whole time..