【发布时间】:2012-10-02 23:48:40
【问题描述】:
首先是一小段代码:
class CDb
{
public:
void CreateLeague(const League &data);
protected:
int InsertOwners(const std::vector<std::string> &owners, int leagueId);
};
void CDb::CreateLeague(const League &data)
{
// some code
if( InsertOwners( data.GetOwners(), leagueId ) != SQLITE_OK )
{
// ROLLBACK transaction
}
}
int CDb::InsertOwners(const std::vector<std::string> &owners, int leagueId)
{
}
函数GetOwners()被声明为:
std::vector<std::string> &GetOwners() const;
在链接过程中,我得到以下信息:
未解析的外部符号“受保护:int __thiscall CDb::InsertOwners(class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > const &,int)”( ?InsertOwners@CDb@@IAEHABV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU ?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@H@Z) 在函数“public: void __thiscall CDb::CreateLeague(class CLeagueSettings const & )" (?CreateLeague@CDb@@QAEXABVCLeagueSettings@@@Z) 1>vc_mswud\baseballdraft.exe:致命错误 LNK1120:1 个未解决的外部问题
在 Windows 7 上使用 MSVC 2010。
请帮忙。
【问题讨论】:
-
您确定包含
CDb::InsertOwners()实现的文件是项目的一部分并且实际上正在编译吗?
标签: visual-c++ linker