我试图为powerdns编译mongodbbackend模块,但我遇到了这个问题:
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
有什么建议吗?
发布于 2012-03-03 23:05:51
你能试试这个补丁吗?
diff --git a/模块/mongodbbackend/mongodbbackend.hh b/modules/mongodbbackend/mongodbbackend.hh index 816128f..4f7cf78 100644 - a/modules/mongodbbackend/mongodbbackend.hh +++ b/模块/mongodbbackend/mongodbbackend.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中
发布于 2012-02-23 16:05:41
来自Ruben的帖子是我的匿名/非帐号帖子。我没有看格式,所以这篇文章有点混乱。
您的编译器错误可以通过添加以下命令来克服:
#include<memory>
并将第109行从:
auto_ptr<mongo::DBClientCursor> cursor;
至
std::auto_ptr<mongo::DBClientCursor> cursor;
然而,这会在我这一端引起其他错误(参见http://pastebin.com/Wm60JCDu)。不过,它可能对您有效:-)
如果你提供更多关于你的环境的信息(发行版,哪个版本的mango和使用的mango驱动程序),这将是很有帮助的。
发布于 2012-02-23 15:50:35
您的编译错误可以通过添加以下命令来克服:
#include<memory>和变化
auto_ptr<mongo::DBClientCursor> cursor;至
std::auto_ptr<mongo::DBClientCursor> cursor;在mangobackend.hh中的第108/109/110行附近
它可能对您有效,但我认为这在很大程度上取决于您正在使用的mangodb api。
如果你提供更多关于你的环境(发行版,芒果版本等)的信息,那将是很有帮助的。
https://stackoverflow.com/questions/9405663
复制相似问题