Unable to compile client under VS2010

275 views
Skip to first unread message

Skot Taka

unread,
Dec 14, 2010, 2:27:15 PM12/14/10
to mongodb-user
I am unable to compile the Mongo client under vs2010 C++ using "scons
mongoclient.lib. I am attempting to follow the instructions given at
http://www.mongodb.org/display/DOCS/Building+with+Visual+Studio+2010.
I see very little help in the forums regarding building under vs2010.

Any suggestions as where to start to fix this problem would be
appreciated, as my C++ skills are minimal.

The resulting console output from scons is shown below:
------------------------------------
scons: Reading SConscript files ...
scons version: 2.0.1
python version: 2 6 4 'final' 0
found visual studio at D:\Program Files\DevTools\Microsoft Visual
Studio 10.0\VC\BIN
boost found at 'C:/Program Files/Boost/boost_1_44'
Windows SDK Root 'C:/Program Files/Microsoft SDKs/Windows/v7.0A'
Checking whether the C++ compiler works(cached) yes
Checking for C++ header file pcrecpp.h... (cached) yes
Checking for C++ header file boost/filesystem/operations.hpp...
(cached) yes
Checking for C library boost_system-mt... (cached) no
Checking for C library boost_system... (cached) no
Checking for C++ header file execinfo.h... (cached) no
Checking for C library pcap... (cached) no
Checking for C library wpcap... (cached) no
Assuming a 32 bit build is desired
Checking for C library js32d... (cached) yes
Checking for C header file js/jsapi.h... (cached) no
Checking for C header file jsapi.h... (cached) yes
Checking whether the C++ compiler works(cached) yes
Checking for C++ header file boost/filesystem/operations.hpp...
(cached) yes
Checking for C library boost_system-mt... (cached) no
Checking for C library boost_system... (cached) no
Checking for C++ header file execinfo.h... (cached) no
Checking for C library pcap... (cached) no
Checking for C library wpcap... (cached) no
Assuming a 32 bit build is desired
Checking for C library js32d... (cached) yes
Checking for C header file js/jsapi.h... (cached) no
Checking for C header file jsapi.h... (cached) yes
Checking for C library readline... (cached) no

*** notice: no readline library, mongo shell will not have nice
interactive line editing ***

scons: done reading SConscript files.
scons: Building targets ...
cl /Foutil\text.obj /c util\text.cpp /TP /nologo /EHsc /W3 /wd4355 /
wd4800 /wd4267 /wd4244 /Od /RTC1 /MDd /Z7 /TP /errorReport:none /
Fd"mongod.pdb" /D_SCONS /DMONGO_EXPOSE_MACROS /DOLDJS /D_UNICODE /
DUNICODE /DWIN32 /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /DHAVE_CONFIG_H /
DPCRE_STATIC /DSUPPORT_UCP /DSUPPORT_UTF8,PSAPI_VERSION=1 /D_DEBUG /
DNOEXECINFO /DXP_WIN /DOLDJS /I. /Ijs\src /IE:\VS2010\Projects\js\src
"/IC:\Program Files\Boost\boost_1_44" /Ipcre-7.4 "/IC:\Program Files
\Microsoft SDKs\Windows\v7.0A\Include" /IE:\VS2010\Projects\winpcap
\Include
text.cpp
util\text.cpp(96) : error C2665:
'boost::system::system_error::system_error' : none of the 7 overloads
could convert all the argument types
C:\Program Files\Boost\boost_1_44\boost/system/
system_error.hpp(30): could be
'boost::system::system_error::system_error(boost::system::error_code,const
std::string &)'
C:\Program Files\Boost\boost_1_44\boost/system/
system_error.hpp(33): or
'boost::system::system_error::system_error(boost::system::error_code,const
char *)'
C:\Program Files\Boost\boost_1_44\boost/system/
system_error.hpp(36): or
'boost::system::system_error::system_error(int,const
boost::system::error_category &)'
while trying to match the argument list '(DWORD, overloaded-
function)'
scons: building terminated because of errors.

---------------------

The line at util/text.cpp(96) in error is:

throw boost::system::system_error(
::GetLastError(), boost::system::system_category);

The referenced lines in boost/system/system_error.hpp(30, 33, 36 ...)
are:

public:
system_error( error_code ec )
: std::runtime_error(""), m_error_code(ec) {}

system_error( error_code ec, const std::string & what_arg )
: std::runtime_error(what_arg), m_error_code(ec) {}

system_error( error_code ec, const char* what_arg )
: std::runtime_error(what_arg), m_error_code(ec) {}

system_error( int ev, const error_category & ecat )
: std::runtime_error(""), m_error_code(ev,ecat) {}

system_error( int ev, const error_category & ecat,
const std::string & what_arg )
: std::runtime_error(what_arg), m_error_code(ev,ecat) {}

system_error( int ev, const error_category & ecat,
const char * what_arg )
: std::runtime_error(what_arg), m_error_code(ev,ecat) {}


dwight_10gen

unread,
Dec 14, 2010, 9:52:14 PM12/14/10
to mongodb-user
ok, i just tried and it works for me, i'm using boost 1.42

i wonder, if you change

throw boost::system::system_error(
::GetLastError(), boost::system::system_category);

in text.cpp to say,

assert(false);

is it happier? if so lmk and i'll look into that.


std::string toUtf8String(const std::wstring& wide)
{
if (wide.size() > boost::integer_traits<int>::const_max)
throw std::length_error(
"Wide string cannot be more than INT_MAX characters long.");
if (wide.size() == 0)
return "";

// Calculate necessary buffer size
int len = ::WideCharToMultiByte(
CP_UTF8, 0, wide.c_str(), static_cast<int>(wide.size()),
NULL, 0, NULL, NULL);

// Perform actual conversion
if (len > 0)
{
std::vector<char> buffer(len);
len = ::WideCharToMultiByte(
CP_UTF8, 0, wide.c_str(), static_cast<int>(wide.size()),
&buffer[0], static_cast<int>(buffer.size()), NULL, NULL);
if (len > 0)
{
assert(len == static_cast<int>(buffer.size()));
return std::string(&buffer[0], buffer.size());
}
}

throw boost::system::system_error(
::GetLastError(), boost::system::system_category);
}


On Dec 14, 2:27 pm, Skot Taka <skotk...@gmail.com> wrote:
> I am unable to compile the Mongo client under vs2010 C++ using "scons
> mongoclient.lib.  I am attempting to follow the instructions given athttp://www.mongodb.org/display/DOCS/Building+with+Visual+Studio+2010.

Skot Taka

unread,
Dec 15, 2010, 10:45:28 AM12/15/10
to mongodb-user
Yes - much better. I was able to build both with the mongoclient.lib
as a target, and the default complete build. I have not tested the
build yet.

I did get a warning message at the end that said:

...
pch.obj : warning LNK4221: This object file does not define any
previously undefined public symbols, so it will not be used by any
link operation that consumes this library
scons: done building targets

Thanks!
Reply all
Reply to author
Forward
0 new messages