Results 1 to 5 of 5

Thread: Clanlib and MongoDB

  1. #1

    Default Clanlib and MongoDB

    Has anyone made Clanlib project that uses the MongoDB C++ client?

    I've been struggling to get it to compile. Running into some sort of header clash between the two libs.

    Just wondering if anyone else has tried this or knows a work around.

    Or alternatives to mongo for indexable non SQL data stores.

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    What is the error you get?

  3. #3

    Default

    Quote Originally Posted by sphair View Post
    What is the error you get?
    Sorry, should have posted it with my Q. Not sure what I was thinking.

    I'm getting this:

    1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(91): warning C4005: 'AF_IPX' : macro redefinition
    1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(460) : see previous definition of 'AF_IPX'
    ...


    followed by the same error for about 200 variables. Not sure where the references to winsock.h or ws2def.h are coming from but it looks like I need to get rid of one.

  4. #4

    Default

    Quote Originally Posted by lampcord View Post
    Sorry, should have posted it with my Q. Not sure what I was thinking.

    I'm getting this:

    1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(91): warning C4005: 'AF_IPX' : macro redefinition
    1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(460) : see previous definition of 'AF_IPX'
    ...


    followed by the same error for about 200 variables. Not sure where the references to winsock.h or ws2def.h are coming from but it looks like I need to get rid of one.
    Maybe try to read that stuff : http://stackoverflow.com/questions/1...n-header-files

    41 down vote


    This problem is caused when including <windows.h> before <winsock2.h>. Try arrange your include list that <windows.h> is included after <winsock2.h> or define _WINSOCKAPI_ first:

    #define _WINSOCKAPI_ // stops windows.h including winsock.h
    #include <windows.h>
    // ...
    #include "MyClass.h" // Which includes <winsock2.h>

  5. #5

    Default

    Quote Originally Posted by RootKernel View Post
    Thanks, good idea. The problem is, the references aren't in any of my code, they are in the library source and I don't want to muck around with that.

    I figured out a solution though. I made a dll called DBProxy.dll that has all of the MongoDB references along with some data classes that are shared with my main program to exchange data with it.

    All of the conversion to/from BSON and all communication with the MongoDB server take place in the dll so my main program is unburdened with any knowledge about how the data is stored. This has the added benefit that I could switch out MongoDB for another DB or even do serverless storage on my own and I would only have to change the dll. My main program would be unaffected.

    This has been tested and it works.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •