【发布时间】:2014-01-24 05:55:20
【问题描述】:
我在 Windows 中收到以下错误。
我有一个库 L1,它具有以下头文件及其实现
namespace TC
{
namespace VT
{
enum Value
{
INVALID = 0,
Light = 1
};
std::ostream& operator<<(std::ostream& os, Value value);
}
}
还有另一个库 L2 使用运算符
L2 库中的代码。
bool Mock::Test(
TC::VT::Value venue )
{
string func(__func__);
cout << func
<< "venue = "
<< venue
<< endl;
return false;
}
cout 行是导致问题的原因。
MockClient.obj : 错误 LNK2019: 无法解析的外部符号“class std::basic_ostream > & __cdecl TC::VT::operator &,enum TC::VT::Value)”
【问题讨论】:
-
好吧,定义在哪里?错误是什么?你的testcase 是什么样的? 2年3个月,你现在应该知道怎么提问了! :)
-
这看起来像是库 L2 没有链接到库 L1 的简单案例
-
链接器找不到
std::ostream& operator<<(std::ostream& os, Value value);的定义 -
@AdityaKumar 不,它搜索不同的功能。
-
你在哪里定义函数
std::ostream& TC::VT::operator<<(class std::basic_ostream > &,enum TC::VT::Value)?
标签: c++ compiler-errors linker-errors