Skip to content

回复:在 Windows 7 上构建比特币时遇到的问题 ​

原始发布页

打开来源页面
查看 1 个交叉存档

它出错的代码行是:

代码:

ERROR extern map<string, string> mapAddressBook;
ERROR extern CCriticalSection cs\_mapAddressBook;
ERROR extern vector<unsigned char> vchDefaultKey;
OK extern bool fClient;
OK extern int nBestHeight;

OK extern unsigned int nWalletDBUpdated;
ERROR extern DbEnv dbenv;

所以它的表现就像什么都没有定义,甚至 map 和 vector 也没有。

然而,db.h 是由 headers.h 引入的(也只在那里引入,其他地方都没有),而 headers.h 在 db.h 之前引入了 vector、map、util.h 以及所有其他内容。

是不是 VC 试图使用预编译头文件,结果把它搞坏了?你的目录中会不会残留着之前失败尝试留下的预编译头文件,而它发现并使用了这些文件?

现在有一个安装程序包,可以非常轻松地安装 MinGW。不要使用最新的 4.5.0 版本,使用往前几个版本,比如 4.4.1 (1.908.0) 或 1.812.0。安装程序会完整安装所有内容,已经不像过去那么麻烦了。我想我唯一需要做的,就是把某个 make*.exe 重命名为 make.exe。 http://tdm-gcc.tdragon.net/

题外话:如果有人愿意动手让 tcatm 的四路 128 位 SSE2 代码在 Windows 上运行起来,那就太好了。MinGW 的优化有些问题,我不确定,但也许是堆栈上的 16 字节对齐有问题,会导致段错误。经过一番调整,我能让他的代码在测试程序中运行,但不知为何在比特币本身中却不行。

英文原文 ​

展开英文原文

The lines it's tripping on:

Code:

ERROR extern map<string, string> mapAddressBook; ERROR extern CCriticalSection cs_mapAddressBook; ERROR extern vector<unsigned char> vchDefaultKey; OK extern bool fClient; OK extern int nBestHeight;

OK extern unsigned int nWalletDBUpdated; ERROR extern DbEnv dbenv;

So it's acting like nothing is defined, not even map and vector.

Yet, db.h is included by headers.h (and only there, nowhere else) which includes vector, map, util.h and everything before db.h.

Is VC trying to use precompiled headers and screwing it up? Could there be some leftover precompiled header files in your directory from previously failed attempts that it's finding and using?

There's an installer package now that makes it really easy to install MinGW. Don't use the latest version 4.5.0, use a few versions back like 4.4.1 (1.908.0) or 1.812.0. A setup program completely installs everything, it's not hard like it used to be. I think the only thing I had to do was rename make*.exe something to make.exe. http://tdm-gcc.tdragon.net/

Off topic, but: It would be nice if someone would hack on getting tcatm's 4-way 128-bit SSE2 code working on Windows. There's something with MinGW's optimisation, I'm not sure but maybe a problem with 16-byte alignment on the stack, that makes it segfault. With some fiddling, I was able to get his code to work in a test program, but not in Bitcoin itself for some reason.

为历史保存,为中文读者整理。每篇档案均附来源与英文原文。