2017-06-04 49 views
1

我跟着make_vcxproj註釋來創建Visual C++項目。我也執行了:使用Visual C++構建mongodb源代碼時出錯

scons generated-sources 

創建錯過的文件。在蒙戈source code的主分支,當我建立這個項目我獲得以下錯誤:

Severity Code Description Project File Line Suppression State Error C2370 'kuint16max': redefinition; different storage class (compiling source file src\third_party\s2\base\strtoint.cc) mongod D:\Open Source\mongo\src\third_party\gperftools-2.5\src\base\basictypes.h 74

似乎也有kuint16max一個在integral_types.h,另一個在basictypes.h兩個全球性的定義。以下是主要部分basictypes.h文件(錯誤相關的):

const uint16 kuint16max = ( (uint16) 0xFFFF); 
const uint32 kuint32max = ( (uint32) 0xFFFFFFFF); 
const uint64 kuint64max = ((((uint64) kuint32max) << 32) | kuint32max); 

const int8 kint8max = ( ( int8) 0x7F); 
const int16 kint16max = ( (int16) 0x7FFF); 
const int32 kint32max = ( (int32) 0x7FFFFFFF); 
const int64 kint64max = ((((int64) kint32max) << 32) | kuint32max); 

const int8 kint8min = ( ( int8) 0x80); 
const int16 kint16min = ( (int16) 0x8000); 
const int32 kint32min = ( (int32) 0x80000000); 
const int64 kint64min = ((((uint64) kint32min) << 32) | 0); 

integral_types.h

static const uint8 kuint8max = ((uint8) 0xFF); 
static const uint16 kuint16max = ((uint16) 0xFFFF); 
static const uint32 kuint32max = ((uint32) 0xFFFFFFFF); 
static const uint64 kuint64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF)); 
static const int8 kint8min = (( int8) 0x80); 
static const int8 kint8max = (( int8) 0x7F); 
static const int16 kint16min = ((int16) 0x8000); 
static const int16 kint16max = ((int16) 0x7FFF); 
static const int32 kint32min = ((int32) 0x80000000); 
static const int32 kint32max = ((int32) 0x7FFFFFFF); 
static const int64 kint64min = ((int64) GG_LONGLONG(0x8000000000000000)); 
static const int64 kint64max = ((int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF)); 

當我改變的Git分支穩定分支,錯誤仍然存​​在。所以我認爲問題在於我的構建。

回答

1

不要使用vcproj東西從源代碼構建MongoDB。它旨在由少數Windows開發人員進行內部盡力而爲的使用。請按照building.md中的構建說明進行操作,並在命令行上使用SCons進行構建。一個好的構建Windows命令行主分支可能看起來像:

python ./buildscripts/scons.py --release -j12 --dynamic-windows --win-version-min=ws08r2 core

但做調整爲適合您的本地系統的-j值。另請注意,building.md文件略有過時(修復程序目前處於代碼審閱狀態),您將需要VS2015 Update 3以及twohotfixes

相關問題