Error compiling C++ client example - dll-interface to be used by clients of class warnings

835 views
Skip to first unread message

Adnan Kobir

unread,
Jan 9, 2015, 4:49:03 PM1/9/15
to mongod...@googlegroups.com
Hello there,

Using the latest source for "mongo-cxx-driver-26compat", I've built the libraries using pre-built boost binaries and have built it using scons with the following arguments:

 C:\>scons --64 --full --use-system-boost --sharedclient --dynamic-windows --prefix="C:\mongo" --cpppath="C:\local\boost_1_55_0" --libpath="C:\local\boost_1_55_0\lib64-msvc-12.0" install-mongoclient

No issues so far.

Now in visual studio 2013 (msvc 12.0). I try to compile the following example:

Warning 2 warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class 'mongo::DBException' c:\mongo\include\mongo\util\assert_util.h 96 1 Mongo155
Warning 47 warning C4275: non dll-interface class 'mongo::PeriodicTask' used as base for dll-interface class 'mongo::DBConnectionPool' c:\mongo\include\mongo\client\connpool.h 153 1 Mongo155
Warning 11 warning C4275: non dll-interface class 'mongo::BSONBuilderBase' used as base for dll-interface class 'mongo::BSONObjBuilder' c:\mongo\include\mongo\bson\bsonobjbuilder.h 52 1 Mongo155
Warning 75 warning C4251: 'mongo::UpdateNotTheSame::_lastErrors' : class 'std::vector<mongo::BSONObj,std::allocator<_Kty>>' needs to have dll-interface to be used by clients of class 'mongo::UpdateNotTheSame' c:\mongo\include\mongo\client\syncclusterconnection.h 206 1 Mongo155
Warning 74 warning C4251: 'mongo::UpdateNotTheSame::_addrs' : class 'std::vector<std::string,std::allocator<_Kty>>' needs to have dll-interface to be used by clients of class 'mongo::UpdateNotTheSame' c:\mongo\include\mongo\client\syncclusterconnection.h 205 1 Mongo155
Warning 62 warning C4251: 'mongo::TagSet::_tags' : struct 'mongo::BSONArray' needs to have dll-interface to be used by clients of class 'mongo::TagSet' c:\mongo\include\mongo\client\dbclient_rs.h 306 1 Mongo155
Warning 72 warning C4251: 'mongo::SyncClusterConnection::_mutex' : class 'mongo::mutex' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 150 1 Mongo155
Warning 73 warning C4251: 'mongo::SyncClusterConnection::_lockTypes' : class 'std::map<std::string,int,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 151 1 Mongo155
Warning 70 warning C4251: 'mongo::SyncClusterConnection::_lastErrors' : class 'std::vector<mongo::BSONObj,std::allocator<_Kty>>' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 145 1 Mongo155
Warning 71 warning C4251: 'mongo::SyncClusterConnection::_customQueryHandler' : class 'boost::scoped_ptr<mongo::SyncClusterConnection::QueryHandler>' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 148 1 Mongo155
Warning 69 warning C4251: 'mongo::SyncClusterConnection::_conns' : class 'std::vector<mongo::DBClientConnection *,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 143 1 Mongo155
Warning 68 warning C4251: 'mongo::SyncClusterConnection::_connAddresses' : class 'std::vector<std::string,std::allocator<_Kty>>' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 142 1 Mongo155
Warning 67 warning C4251: 'mongo::SyncClusterConnection::_address' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::SyncClusterConnection' c:\mongo\include\mongo\client\syncclusterconnection.h 141 1 Mongo155
Warning 78 warning C4251: 'mongo::SSLGlobalParams::sslPEMKeyPassword' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 35 1 Mongo155
Warning 77 warning C4251: 'mongo::SSLGlobalParams::sslPEMKeyFile' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 34 1 Mongo155
Warning 76 warning C4251: 'mongo::SSLGlobalParams::sslMode' : class 'mongo::AtomicWord<int>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 32 1 Mongo155
Warning 82 warning C4251: 'mongo::SSLGlobalParams::sslCRLFile' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 39 1 Mongo155
Warning 80 warning C4251: 'mongo::SSLGlobalParams::sslClusterPassword' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 37 1 Mongo155
Warning 79 warning C4251: 'mongo::SSLGlobalParams::sslClusterFile' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 36 1 Mongo155
Warning 81 warning C4251: 'mongo::SSLGlobalParams::sslCAFile' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::SSLGlobalParams' c:\mongo\include\mongo\util\net\ssl_options.h 38 1 Mongo155
Warning 15 warning C4251: 'mongo::Socket::_remote' : struct 'mongo::SockAddr' needs to have dll-interface to be used by clients of class 'mongo::Socket' c:\mongo\include\mongo\util\net\sock.h 287 1 Mongo155
Warning 16 warning C4251: 'mongo::Socket::_logLevel' : class 'mongo::logger::LogSeverity' needs to have dll-interface to be used by clients of class 'mongo::Socket' c:\mongo\include\mongo\util\net\sock.h 298 1 Mongo155
Warning 14 warning C4251: 'mongo::Socket::_local' : struct 'mongo::SockAddr' needs to have dll-interface to be used by clients of class 'mongo::Socket' c:\mongo\include\mongo\util\net\sock.h 286 1 Mongo155
Warning 52 warning C4251: 'mongo::ScopedDbConnection::_host' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::ScopedDbConnection' c:\mongo\include\mongo\client\connpool.h 361 1 Mongo155
Warning 24 warning C4251: 'mongo::QuerySpec::_ns' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::QuerySpec' c:\mongo\include\mongo\client\dbclientinterface.h 479 1 Mongo155
Warning 23 warning C4251: 'mongo::Query::ReadPrefTagsField' : class 'mongo::BSONField<mongo::BSONArray>' needs to have dll-interface to be used by clients of class 'mongo::Query' c:\mongo\include\mongo\client\dbclientinterface.h 359 1 Mongo155
Warning 22 warning C4251: 'mongo::Query::ReadPrefModeField' : class 'mongo::BSONField<std::string>' needs to have dll-interface to be used by clients of class 'mongo::Query' c:\mongo\include\mongo\client\dbclientinterface.h 358 1 Mongo155
Warning 21 warning C4251: 'mongo::Query::ReadPrefField' : class 'mongo::BSONField<mongo::BSONObj>' needs to have dll-interface to be used by clients of class 'mongo::Query' c:\mongo\include\mongo\client\dbclientinterface.h 357 1 Mongo155
Warning 46 warning C4251: 'mongo::PoolForHost::_pool' : class 'std::stack<mongo::PoolForHost::StoredConnection,std::deque<_Ty,std::allocator<_Ty>>>' needs to have dll-interface to be used by clients of class 'mongo::PoolForHost' c:\mongo\include\mongo\client\connpool.h 120 1 Mongo155
Warning 45 warning C4251: 'mongo::PoolForHost::_hostName' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::PoolForHost' c:\mongo\include\mongo\client\connpool.h 119 1 Mongo155
Warning 6 warning C4251: 'mongo::logger::LogstreamBuilder::_severity' : class 'mongo::logger::LogSeverity' needs to have dll-interface to be used by clients of class 'mongo::logger::LogstreamBuilder' c:\mongo\include\mongo\logger\logstream_builder.h 132 1 Mongo155
Warning 5 warning C4251: 'mongo::logger::LogstreamBuilder::_contextName' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::logger::LogstreamBuilder' c:\mongo\include\mongo\logger\logstream_builder.h 131 1 Mongo155
Warning 7 warning C4251: 'mongo::logger::LogstreamBuilder::_baseMessage' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::logger::LogstreamBuilder' c:\mongo\include\mongo\logger\logstream_builder.h 133 1 Mongo155
Warning 64 warning C4251: 'mongo::GridFS::_prefix' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::GridFS' c:\mongo\include\mongo\client\gridfs.h 126 1 Mongo155
Warning 65 warning C4251: 'mongo::GridFS::_filesNS' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::GridFS' c:\mongo\include\mongo\client\gridfs.h 127 1 Mongo155
Warning 63 warning C4251: 'mongo::GridFS::_dbName' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::GridFS' c:\mongo\include\mongo\client\gridfs.h 125 1 Mongo155
Warning 66 warning C4251: 'mongo::GridFS::_chunksNS' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::GridFS' c:\mongo\include\mongo\client\gridfs.h 128 1 Mongo155
Warning 1 warning C4251: 'mongo::ExceptionInfo::msg' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'mongo::ExceptionInfo' c:\mongo\include\mongo\util\assert_util.h 71 1 Mongo155
Warning 3 warning C4251: 'mongo::DBException::_shard' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBException' c:\mongo\include\mongo\util\assert_util.h 121 1 Mongo155
Warning 50 warning C4251: 'mongo::DBConnectionPool::_pools' : class 'std::map<mongo::DBConnectionPool::PoolKey,mongo::PoolForHost,mongo::DBConnectionPool::poolKeyCompare,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'mongo::DBConnectionPool' c:\mongo\include\mongo\client\connpool.h 247 1 Mongo155
Warning 49 warning C4251: 'mongo::DBConnectionPool::_name' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBConnectionPool' c:\mongo\include\mongo\client\connpool.h 240 1 Mongo155
Warning 48 warning C4251: 'mongo::DBConnectionPool::_mutex' : class 'mongo::mutex' needs to have dll-interface to be used by clients of class 'mongo::DBConnectionPool' c:\mongo\include\mongo\client\connpool.h 239 1 Mongo155
Warning 27 warning C4251: 'mongo::DBClientWithCommands::MRInline' : struct 'mongo::DBClientWithCommands::MROutput' needs to have dll-interface to be used by clients of class 'mongo::DBClientWithCommands' c:\mongo\include\mongo\client\dbclientinterface.h 840 1 Mongo155
Warning 25 warning C4251: 'mongo::DBClientWithCommands::_seenIndexes' : class 'std::set<std::string,std::less<_Kty>,std::allocator<_Kty>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientWithCommands' c:\mongo\include\mongo\client\dbclientinterface.h 606 1 Mongo155
Warning 28 warning C4251: 'mongo::DBClientWithCommands::_runCommandHook' : class 'boost::function<void (mongo::BSONObjBuilder *)>' needs to have dll-interface to be used by clients of class 'mongo::DBClientWithCommands' c:\mongo\include\mongo\client\dbclientinterface.h 1051 1 Mongo155
Warning 29 warning C4251: 'mongo::DBClientWithCommands::_postRunCommandHook' : class 'boost::function<void (const mongo::BSONObj &,const std::string &)>' needs to have dll-interface to be used by clients of class 'mongo::DBClientWithCommands' c:\mongo\include\mongo\client\dbclientinterface.h 1052 1 Mongo155
Warning 26 warning C4251: 'mongo::DBClientWithCommands::_logLevel' : class 'mongo::logger::LogSeverity' needs to have dll-interface to be used by clients of class 'mongo::DBClientWithCommands' c:\mongo\include\mongo\client\dbclientinterface.h 609 1 Mongo155
Warning 53 warning C4251: 'mongo::DBClientReplicaSet::_setName' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 229 1 Mongo155
Warning 60 warning C4251: 'mongo::DBClientReplicaSet::_nodeSelectOracle' : class 'mongo::PseudoRandom' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 257 1 Mongo155
Warning 54 warning C4251: 'mongo::DBClientReplicaSet::_masterHost' : struct 'mongo::HostAndPort' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 231 1 Mongo155
Warning 55 warning C4251: 'mongo::DBClientReplicaSet::_master' : class 'boost::shared_ptr<mongo::DBClientConnection>' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 238 1 Mongo155
Warning 61 warning C4251: 'mongo::DBClientReplicaSet::_lazyState' : class 'mongo::DBClientReplicaSet::LazyState' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 273 1 Mongo155
Warning 56 warning C4251: 'mongo::DBClientReplicaSet::_lastSlaveOkHost' : struct 'mongo::HostAndPort' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 241 1 Mongo155
Warning 57 warning C4251: 'mongo::DBClientReplicaSet::_lastSlaveOkConn' : class 'boost::shared_ptr<mongo::DBClientConnection>' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 243 1 Mongo155
Warning 58 warning C4251: 'mongo::DBClientReplicaSet::_lastReadPref' : class 'boost::shared_ptr<mongo::ReadPreferenceSetting>' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 244 1 Mongo155
Warning 59 warning C4251: 'mongo::DBClientReplicaSet::_auths' : class 'std::map<std::string,mongo::BSONObj,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientReplicaSet' c:\mongo\include\mongo\client\dbclient_rs.h 252 1 Mongo155
Warning 41 warning C4251: 'mongo::DBClientCursor::ns' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientCursor' c:\mongo\include\mongo\client\dbclientcursor.h 225 1 Mongo155
Warning 39 warning C4251: 'mongo::DBClientCursor::batch' : class 'mongo::DBClientCursor::Batch' needs to have dll-interface to be used by clients of class 'mongo::DBClientCursor' c:\mongo\include\mongo\client\dbclientcursor.h 222 1 Mongo155
Warning 43 warning C4251: 'mongo::DBClientCursor::_scopedHost' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientCursor' c:\mongo\include\mongo\client\dbclientcursor.h 237 1 Mongo155
Warning 42 warning C4251: 'mongo::DBClientCursor::_putBack' : class 'std::stack<mongo::BSONObj,std::deque<_Ty,std::allocator<_Ty>>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientCursor' c:\mongo\include\mongo\client\dbclientcursor.h 233 1 Mongo155
Warning 40 warning C4251: 'mongo::DBClientCursor::_originalHost' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientCursor' c:\mongo\include\mongo\client\dbclientcursor.h 224 1 Mongo155
Warning 44 warning C4251: 'mongo::DBClientCursor::_lazyHost' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientCursor' c:\mongo\include\mongo\client\dbclientcursor.h 238 1 Mongo155
Warning 32 warning C4251: 'mongo::DBClientConnection::server' : class 'boost::scoped_ptr<mongo::SockAddr>' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1346 1 Mongo155
Warning 31 warning C4251: 'mongo::DBClientConnection::p' : class 'boost::scoped_ptr<mongo::MessagingPort>' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1345 1 Mongo155
Warning 33 warning C4251: 'mongo::DBClientConnection::autoReconnectBackoff' : class 'mongo::Backoff' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1349 1 Mongo155
Warning 37 warning C4251: 'mongo::DBClientConnection::authCache' : class 'std::map<std::string,mongo::BSONObj,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1358 1 Mongo155
Warning 35 warning C4251: 'mongo::DBClientConnection::_serverString' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1351 1 Mongo155
Warning 36 warning C4251: 'mongo::DBClientConnection::_serverAddrString' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1352 1 Mongo155
Warning 34 warning C4251: 'mongo::DBClientConnection::_server' : struct 'mongo::HostAndPort' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1350 1 Mongo155
Warning 38 warning C4251: 'mongo::DBClientConnection::_numConnections' : struct 'mongo::AtomicUInt' needs to have dll-interface to be used by clients of class 'mongo::DBClientConnection' c:\mongo\include\mongo\client\dbclientinterface.h 1362 1 Mongo155
Warning 30 warning C4251: 'mongo::DBClientBase::ConnectionIdSequence' : class 'mongo::AtomicWord<__int64>' needs to have dll-interface to be used by clients of class 'mongo::DBClientBase' c:\mongo\include\mongo\client\dbclientinterface.h 1065 1 Mongo155
Warning 18 warning C4251: 'mongo::ConnectionString::_string' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::ConnectionString' c:\mongo\include\mongo\client\dbclientinterface.h 328 1 Mongo155
Warning 19 warning C4251: 'mongo::ConnectionString::_setName' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::ConnectionString' c:\mongo\include\mongo\client\dbclientinterface.h 329 1 Mongo155
Warning 17 warning C4251: 'mongo::ConnectionString::_servers' : class 'std::vector<mongo::HostAndPort,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'mongo::ConnectionString' c:\mongo\include\mongo\client\dbclientinterface.h 327 1 Mongo155
Warning 20 warning C4251: 'mongo::ConnectionString::_connectHookMutex' : class 'mongo::mutex' needs to have dll-interface to be used by clients of class 'mongo::ConnectionString' c:\mongo\include\mongo\client\dbclientinterface.h 331 1 Mongo155
Warning 10 warning C4251: 'mongo::BSONObjBuilderValueStream::_subobj' : class 'std::auto_ptr<mongo::BSONObjBuilder>' needs to have dll-interface to be used by clients of class 'mongo::BSONObjBuilderValueStream' c:\mongo\include\mongo\bson\bsonmisc.h 238 1 Mongo155
Warning 9 warning C4251: 'mongo::BSONObjBuilderValueStream::_fieldName' : class 'mongo::StringData' needs to have dll-interface to be used by clients of class 'mongo::BSONObjBuilderValueStream' c:\mongo\include\mongo\bson\bsonmisc.h 233 1 Mongo155
Warning 13 warning C4251: 'mongo::BSONObjBuilder::numStrs' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'mongo::BSONObjBuilder' c:\mongo\include\mongo\bson\bsonobjbuilder.h 701 1 Mongo155
Warning 12 warning C4251: 'mongo::BSONObjBuilder::_buf' : class 'mongo::_BufBuilder<mongo::TrivialAllocator>' needs to have dll-interface to be used by clients of class 'mongo::BSONObjBuilder' c:\mongo\include\mongo\bson\bsonobjbuilder.h 695 1 Mongo155
Warning 8 warning C4251: 'mongo::BSONObj::_holder' : class 'boost::intrusive_ptr<mongo::BSONObj::Holder>' needs to have dll-interface to be used by clients of class 'mongo::BSONObj' c:\mongo\include\mongo\bson\bsonobj.h 557 1 Mongo155
Warning 51 warning C4251: 'mongo::AScopedConnection::_numConnections' : struct 'mongo::AtomicUInt' needs to have dll-interface to be used by clients of class 'mongo::AScopedConnection' c:\mongo\include\mongo\client\connpool.h 277 1 Mongo155
Error 4 error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\mongo\include\mongo\util\goodies.h 153 1 Mongo155



Any help would be greatly appreciated!

Andrew Morrow

unread,
Jan 10, 2015, 10:37:15 AM1/10/15
to mongod...@googlegroups.com

Hi -

The warnings are, unfortunately, unavoidable by our current understanding when building the library as a DLL. On the legacy branch we have added warning suppressions so these at least are hidden.

You do have one real error shown here, which is Windows complaining about use of strncpy. You should be able to eliminate this by defining _CRT_SECURE_NO_WARNINGS as suggested in the error message. Again, on the legacy branch, we suppress these warnings for you when using the dbclient.h or bson.h header.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/26677eaa-ee60-4d87-abdf-fc2203059621%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adnan Kobir

unread,
Jan 12, 2015, 9:00:13 AM1/12/15
to mongod...@googlegroups.com
Thanks for the prompt response. I have added the _CRT_SECURE_NO_WARNINGS flag to the preprocessor and it does compile but the executable has a strange issue:

'MongoTest.exe' (Win32): Loaded 'C:\Users\ak\Documents\Visual Studio 2013\Projects\MongoTest\x64\Debug\MongoTest.exe'. Symbols loaded.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\msvcp120d.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Users\ak\Documents\Visual Studio 2013\Projects\MongoTest\x64\Debug\mongoclient.dll'. Symbols loaded.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\msvcr120.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\msvcr120d.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\dbghelp.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\msvcp120.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\nsi.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Cannot find or open the PDB file.
'MongoTest.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Cannot find or open the PDB file.
First-chance exception at 0x00007FFDE992606C in MongoTest.exe: Microsoft C++ exception: mongo::UserException at memory location 0x000000832F84EF80.
The thread 0x1040 has exited with code 0 (0x0).
The program '[7104] MongoTest.exe' has exited with code 0 (0x0).




When I try to run the application is get the following error:

2015-01-12T08:55:38.170-0500 getaddrinfo("@?AdX") failed: errno:11003 A non-recoverable error occurred during a database lookup.
caught can't connect couldn't connect to server @╤AdX:27017 (0.0.0.0), address resolved to 0.0.0.0

Seems that there is an issue with the connect string:

c.connect("localhost");

I've tried using 'localhost' and '127.0.0.1' - seems like whatever I type in, it comes out as garbage in the console for the connect address. Any ideas? 


...

Andrew Morrow

unread,
Jan 12, 2015, 9:59:39 AM1/12/15
to mongod...@googlegroups.com

Are you linking your application with the same version of the runtime DLL as the library? Based on the build flags you used for building the C++ driver, you will want to build your application with /MD (see http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx) to select the Retail DLL version of the runtime.

Please note that support for building on windows is considerably improved on the legacy branch.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.

Adnan Kobir

unread,
Jan 12, 2015, 10:15:07 AM1/12/15
to mongod...@googlegroups.com
Ok figured it out, for anyone else - ensure your C/C++ commandline in Visual Studio looks like this:

/GS /W1 /Zc:wchar_t /Zi /Gm- /O2 /Fd"x64\Debug\vc120.pdb" /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /MD /Fa"x64\Debug\" /EHsc /nologo /Fo"x64\Debug\" /Fp"x64\Debug\MongoClient.pch" 

I believe it was an encoding issue that caused my connect string to come out garbled.


...
Reply all
Reply to author
Forward
0 new messages