Re: Building C++ Driver on Windows 7

88 views
Skip to first unread message

Scott Stephens

unread,
Aug 24, 2012, 4:46:05 PM8/24/12
to mongo...@googlegroups.com
Never was able to get this resolved.  For the benefit of any future Googlers, I just used the plain C driver, which is much easier to build.  Not an ideal solution, but it works.

On Tuesday, August 21, 2012 10:51:15 AM UTC-5, Scott Stephens wrote:
I've been using the C# driver successfully for a while now, and am now attempting to add mongo connectivity to some of my C++ apps, and have not been able to figure out how to use it.  I'm not completely sure whether I'm having a build problem or a usage problem.

I built from the 2.0.7 source (full, not client-only... tried client only briefly, and had no luck making that work).  I'm on Windows 7 64-bit, Visual Studio 2010.  I've used the following commands to build:
- scons mongoclient
- scons --prefix=..\mongo-install mongoclient
- scons --prefix=..\mongo-install --release mongoclient

They all seem to work, and produce a mongoclient.lib file in the base distribution directory, but they don't install to any location that I can find, leading me to guess about what I need to do to use it from a project.  The guess I tried was to create mongo-install\lib and mongo-install\include directories, copy the mongoclient.lib directory to mongo-install\lib and copy the client folder to mongo-install\include.  Then I use those paths as include and lib directories in my project. This approach gives me a build error in my project "C1083: cannot open include file '../pch.h': No such file or directory".

Any suggestions on how to proceed?

Thanks,

Scott

Pedro Larroy

unread,
Sep 3, 2012, 7:00:59 AM9/3/12
to mongo...@googlegroups.com
Hi

I'm building windows driver with vs2010 and scons, I changed the
compile flags to match my project and other minor fixes, if you want I
can share my modifications. I had to fix several minor things to make
it work, and change the compilation flags.

Then in common properties -> Linker I added
'$(SolutionDir)3rd-party\mongo-cxx-driver\' and in common properties
-> C/C++, additional include directories I added
'$(SolutionDir)\3rd-party\mongo-cxx-driver\src'


Pedro.



On Tue, Aug 21, 2012 at 5:51 PM, Scott Stephens <steph...@gmail.com> wrote:
> I've been using the C# driver successfully for a while now, and am now
> attempting to add mongo connectivity to some of my C++ apps, and have not
> been able to figure out how to use it. I'm not completely sure whether I'm
> having a build problem or a usage problem.
>
> I built from the 2.0.7 source (full, not client-only... tried client only
> briefly, and had no luck making that work). I'm on Windows 7 64-bit, Visual
> Studio 2010. I've used the following commands to build:
> - scons mongoclient
> - scons --prefix=..\mongo-install mongoclient
> - scons --prefix=..\mongo-install --release mongoclient
>
> They all seem to work, and produce a mongoclient.lib file in the base
> distribution directory, but they don't install to any location that I can
> find, leading me to guess about what I need to do to use it from a project.
> The guess I tried was to create mongo-install\lib and mongo-install\include
> directories, copy the mongoclient.lib directory to mongo-install\lib and
> copy the client folder to mongo-install\include. Then I use those paths as
> include and lib directories in my project. This approach gives me a build
> error in my project "C1083: cannot open include file '../pch.h': No such
> file or directory".
>
> Any suggestions on how to proceed?
>
> Thanks,
>
> Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-dev/-/9R-f3VO4mhcJ.
> To post to this group, send email to mongo...@googlegroups.com.
> To unsubscribe from this group, send email to
> mongodb-dev...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mongodb-dev?hl=en.

Scott Stephens

unread,
Sep 4, 2012, 10:38:27 AM9/4/12
to mongo...@googlegroups.com
Thanks Pedro, I'll give that a shot.

Pedro Larroy

unread,
Sep 6, 2012, 5:44:52 PM9/6/12
to mongo...@googlegroups.com
I attach my SConstruct...

builds debug and release versions of the driver

I forgot to add that you need to link also with mongoclient_release.lib or
mongoclient_debug.lib....


Pedro.
> https://groups.google.com/d/msg/mongodb-dev/-/mTe1OU70SA0J.
SConstruct
Reply all
Reply to author
Forward
0 new messages