在Cygwin上编译MongoDB C ++驱动程序 [英] Compiling MongoDB C++ driver on Cygwin
问题描述
我试着用'scons'命令编译Cygwin上的MongoDB C ++驱动程序,并得到以下错误:
I junt trying compile the MongoDB C++ driver on Cygwin with the 'scons' command and i getting this follow error:
src/mongo/db/nonce.cpp:48:20: error: ‘srandomdev’ was not declared in this scope
$ b b
这是什么lib?
What lib is that?
谢谢。
推荐答案
srandomdev函数在BSD或OSX系统上的 stdlib.h 中可用,而不是在像Cygwin或Linux这样的GNU系统上。
The srandomdev function is available in stdlib.h on BSD or OSX systems, not on GNU systems like Cygwin or Linux.
构建脚本不能识别您在Cygwin上运行的事实。有几个选项,你可以尝试。最简单的是
It looks like the build script does not recognize the fact that you are running on Cygwin. There are a few options that you can try. The easiest ones are
如果没有Windows机器来测试,确认这将为您工作。
在 src / mongo / platform / random.cpp ,编辑第108行
Without a Windows machine to test this on, it is hard to confirm this will work for you. In src/mongo/platform/random.cpp , edit line 108
#elif defined(__linux__) || defined(__sunos__) || defined(__APPLE__)
为
#elif defined(__linux__) || defined(__sunos__) || defined(__APPLE__) || defined(__CYGWIN__)
删除最后一个else子句
查找类似
Delete the last else clause
Find the line (141 in my version) of src/mongo/platform/random.cpp that looks like
#else
class SRandSecureRandom : public SecureRandom {
public:
删除行到 #endif
子句,然后编辑
Delete the lines down to the #endif
clause and then edit
#elif defined(__linux__) || defined(__sunos__) || defined(__APPLE__)
只是
#else
这篇关于在Cygwin上编译MongoDB C ++驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!