(__ imp_?姓名装饰

时间:2015-10-25 01:30:29

标签: c++ mongodb

我正在尝试在Visual Studio 2015控制台应用程序中使用MongoDB C ++驱动程序 - 我收到以下错误:

错误LNK2019:未解析的外部符号“__declspec(dllimport)void __cdecl mongo :: msgasserted(int,char const *)”(__ imp_?msgasserted @ mongo @@ YAXHPBD @ Z) 在函数“private:void __thiscall mongo :: HostAndPort :: init(char const *)”中引用(?init @ HostAndPort @ mongo @@ AAEXPBD @ Z)

dumpbin.exe显示该符号

?msgasserted @ @@蒙戈YAXHPBD @ Z

存在于libmongoclient.lib文件中, 但

(__ imp_?msgasserted @ mongo @@ YAXHPBD @ Z msgasserted @ mongo @@ YAXHPBD @ Z

没有。 我看到函数名称以?为前缀的示例,有时看到相同的__imp_?前缀 - 但没有找到这种名称装饰的解释。

另一个错误示例:

错误LNK2019:未解析的外部符号“__declspec(dllimport)public:__ thiscall mongo :: DBClientConnection :: DBClientConnection(bool, class mongo :: DBClientReplicaSet *,double)“ (__imp _ ?? 0DBClientConnection @ @@蒙戈QAE @ _NPAVDBClientReplicaSet @ 1 @ N @ Z)  在函数中引用 “public:__ thiscall DAO :: DAO(class std :: basic_string,class std :: allocator>, class std :: basic_string,class std :: allocator>, class std :: basic_string,class std :: allocator>)“ (?? 0DAO @@ QAE @ V?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ 00 @ Z):: DBClientConnection(bool,class mongo :: DBClientReplicaSet *,double)“(__ imp _ ?? 0DBClientConnection @ mongo @@ QAE @ _NPAVDBClientReplicaSet @ 1 @ N @ Z) 在函数“public:__thiscall DAO :: DAO中引用(类std :: basic_string,类std :: allocator>, class std :: basic_string, class std :: allocator>,class std :: basic_string,class std :: allocator>)“(?? 0DAO @@ QAE @ V?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ d @ @@ 2 STD @@ @ 00 Z)

我想创建DBClientConnection类的实例 - 我的代码的一部分:

#pragma once
#include <cstdlib>
#include <string>
#include <iostream>
#include "mongo/client/dbclient.h"

using namespace mongo;

class DAO
{
 public:
    DAO();
    virtual ~DAO();
    DAO(std::string url, std::string user, std::string password);
 private:
    static const std::string dbUrl;
    static const std::string dbUser;
    static const std::string dbPassword;

    DBClientConnection connection;

..................

如何修复链接问题?我需要如何使用DBClientConnection类?提前谢谢。

0 个答案:

没有答案