powerdns + mongodb

powerdns + mongodb

本文关键字:mongodb powerdns      更新时间:2023-10-16

我试图编译powerdns的mongodbendend模块,但遇到了这个问题:

In file included from mongodbbackend.cc:18:
mongodbbackend.hh: At global scope:
mongodbbackend.hh:109: error: ISO C++ forbids declaration of ‘auto_ptr’ with no type
mongodbbackend.hh:109: error: expected unqualified-id before ‘<’ token
make[3]: *** [mongodbbackend.lo] Error 1
make[3]: Leaving directory `/root/pdns-3.0.1/modules/mongodbbackend'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/pdns-3.0.1/modules'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/pdns-3.0.1'
make: *** [all] Error 2

我尝试包含mongodb 2.0.2和2.0.3中的文件。以下是模块来源:http://wiki.powerdns.com/trac/browser/trunk/pdns/modules/mongodbbackend

有什么建议吗?

Ruben的帖子是我的匿名/非账户帖子。我没有看格式,所以这篇文章有点乱。

您的编译器错误可以通过添加以下内容来克服:

#include<memory>

将109行从:改为

auto_ptr<mongo::DBClientCursor> cursor;

std::auto_ptr<mongo::DBClientCursor> cursor;

然而,这会导致我的其他错误(请参阅http://pastebin.com/Wm60JCDu)。它可能对你有用:-)

如果您提供更多关于您的环境的信息(发行版、mangodb的版本和使用的mango驱动程序),这将非常有用。

你能试试这个补丁吗?

diff—git a/modules/mongodbbackend/mongodbackend.hh b/modules/mongodbackend/mongobbackend.hh索引816128f。。4f7cf78 100644---a/modules/megodbackend/mongodbackend.hh+++b/modules/megodbackend/mongodbackend.hh@@-1,13+1,13@@#ifndef MONGODB_HH#定义MONGODB_HH

+#include "client/dbclient.h"
 #include "pdns/dnsbackend.hh"
 #undef VERSION
 #include <string>
 using std::string;
-
-#include "client/dbclient.h"
+using std::auto_ptr;
 class MONGODBException {
 public:

它在https://github.com/azlev/powerdns/commit/a402d8493e5610e139ea19a9ef700e26b2e6e35c

可以通过添加来克服编译错误

#include<memory>

和更改

auto_ptr<mongo::DBClientCursor> cursor;

std::auto_ptr<mongo::DBClientCursor> cursor;

mangobackend.hh108/109/110线附近

它可能对您有效,但我认为这在很大程度上取决于您使用的mangodbapi。

如果您提供更多关于您的环境(发行版、mango版本等)的信息,

将非常有用