不知道我在这里做错了什么,但是说我有:
foo.h中
class foo
{
public:
int Get10(std::wstring);
};
Run Code Online (Sandbox Code Playgroud)
Foo.cpp中
int foo::Get10(std::wstring dir)
{
return 10;
};
Run Code Online (Sandbox Code Playgroud)
我将它编译为lib,如果我将lib包含在另一个项目中以及相关的头文件(foo.h)并尝试调用foo的实例:
foo f;
f.Get10(L"ABC");
Run Code Online (Sandbox Code Playgroud)
我收到链接器错误说:
错误1错误LNK2005:"public:__thiscall std :: _ Container_base12 ::〜_Container_base12(void)"(?? 1_Container_base12 @std @@ QAE @ XZ)已在foo.lib中定义(foo.obj)C:\ foo\msvcprtd .lib(MSVCP100D.dll)footest
任何想法为什么会这样?