高手出马啦,关于C++迭代器的问题,折腾我一上午,急啊,编译环境VS2005

desaili2002 2010-04-02 04:08:57
高手出马啦,关于C++迭代器的问题:耐心看啊,代码有点长,编译环境VS2005
先给出错误,链接不到函数
1>NetworkOperationRunnable.obj : error LNK2019: 无法解析的外部符号 "public: bool __cdecl NetworkLinkCollection::downloadBook(class BookReference const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class ZLNetworkSSLCertificate const &,class shared_ptr<class ZLExecutionData::Listener>)" (?downloadBook@NetworkLinkCollection@@QAA_NABVBookReference@@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVZLNetworkSSLCertificate@@V?$shared_ptr@VListener@ZLExecutionData@@@@@Z),该符号在函数 "public: virtual void __cdecl DownloadBookRunnable::run(void)" (?run@DownloadBookRunnable@@UAAXXZ) 中被引用


class NetworkLinkCollection {

private:
class Comparator;

public:
static NetworkLinkCollection &Instance();

private:
static NetworkLinkCollection *ourInstance;

public:
ZLStringOption DirectoryOption;

private:
NetworkLinkCollection();
~NetworkLinkCollection();

public:
std::string bookFileName(const BookReference &reference) const;
std::string makeBookFileName(const BookReference &reference);

bool downloadBook(const BookReference &reference, std::string &fileName, const ZLNetworkSSLCertificate &sslSertificate, shared_ptr<ZLExecutionData::Listener> listener);

shared_ptr<NetworkBookCollection> simpleSearch(const std::string &pattern);
shared_ptr<NetworkBookCollection> advancedSearch(const std::string &titleAndSeries, const std::string &author, const std::string &tag, const std::string &annotation);

size_t size() const;
size_t numberOfEnabledLinks() const;
NetworkLink &link(size_t index) const;

const std::string &errorMessage() const;

void rewriteUrl(std::string &url, bool externalUrl = false) const;

private:
std::string makeBookFileName(const std::string &url, BookReference::Format format, BookReference::Type type, bool createDirectories);

private:
typedef std::vector<shared_ptr<NetworkLink> > LinkVector;
LinkVector myLinks;

std::string myErrorMessage;
};

downloadBook函数原型(确认已经加入到工程)
bool NetworkLinkCollection::downloadBook(const BookReference &reference, std::string &fileName, const ZLNetworkSSLCertificate &sslCertificate, shared_ptr<ZLExecutionData::Listener> listener) {
std::string nURL = ::normalize(reference.URL);
rewriteUrl(nURL);
const std::string nNetworkBookId = ::normalize(reference.cleanURL());
const ZLResource &errorResource = ZLResource::resource("dialog")["networkError"];
myErrorMessage.clear();

if (nURL.empty() || nNetworkBookId.empty()) {
myErrorMessage = errorResource["unknownErrorMessage"].value();
return false;
}
std::string storedFileName = BooksDB::Instance().getNetFile(nNetworkBookId);
if (!storedFileName.empty() && ZLFile(storedFileName).exists()) {
fileName = storedFileName;
return true;
}
fileName = makeBookFileName(nNetworkBookId, reference.BookFormat, reference.ReferenceType, true);
if (fileName.empty()) {
if (myErrorMessage.empty()) {
myErrorMessage = errorResource["unknownErrorMessage"].value();
}
return false;
}
if (ZLFile(fileName).exists()) {
ZLFile(fileName).remove();
}
myErrorMessage = ZLNetworkManager::Instance().downloadFile(nURL, sslCertificate, fileName, listener);
if (!myErrorMessage.empty()) {
return false;
}
BooksDB::Instance().setNetFile(nNetworkBookId, fileName);
return true;
}

NetworkLinkCollection &NetworkLinkCollection::Instance() {
if (ourInstance == 0) {
ourInstance = new NetworkLinkCollection();
}
return *ourInstance;
}


class DownloadBookRunnable : public NetworkOperationRunnable {

public:
DownloadBookRunnable(shared_ptr<BookReference> reference, shared_ptr<NetworkAuthenticationManager> authManager);
DownloadBookRunnable(const std::string &url);
~DownloadBookRunnable();
void run();

const std::string &fileName() const;

private:
shared_ptr<BookReference> myReference;
shared_ptr<NetworkAuthenticationManager> myAuthManager;
std::string myFileName;
};


void DownloadBookRunnable::run() {
NetworkLinkCollection::Instance().downloadBook(
*myReference, myFileName,
myAuthManager.isNull() ? ZLNetworkSSLCertificate::NULL_CERTIFICATE : myAuthManager->certificate(),
myDialog->listener()
);//就这里链接不过啊,真气人
myErrorMessage = NetworkLinkCollection::Instance().errorMessage();
}
...全文
181 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
desaili2002 2010-04-02
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 desaili2002 的回复:]
公司不能发邮件,30多M呢
[/Quote]

行,学起,晚上回去看看
fanqing520 2010-04-02
  • 打赏
  • 举报
回复
代码太长,把完整的代码发来看看 也许能找到原因
ypb362148418 2010-04-02
  • 打赏
  • 举报
回复
代码很长,不过看你那个链接错误,检查下你的库文件和外部引用吧,说不准,不涉密的情况下发给LS看看吧
赵4老师 2010-04-02
  • 打赏
  • 举报
回复
《标准模板库自修教程与参考手册 STL进行C++编程》
desaili2002 2010-04-02
  • 打赏
  • 举报
回复
公司不能发邮件,30多M呢
晨星 2010-04-02
  • 打赏
  • 举报
回复
如果代码中没有什么机密的话,把整个工程打个包(中间文件都删掉,尤其是ncb),发到steedhorse@163.net帮你看看?

64,649

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧