Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:55:32+00:00 2026-06-09T11:55:32+00:00

I compiled the MongoDB C Drivers successfully and run the test scripts also but

  • 0

I compiled the MongoDB C Drivers successfully and run the test scripts also but I am not able to compile the scripts which I am writing myself.

Following is the command and its error output.

$ gcc -Isrc --std=c99 ./src/*.c -I ./src/ tutorial.c -o tutorial -D_POSIX_C_SOURCE=200112L

./src/env_win32.c:27:53: fatal error: ws2tcpip.h: No such file or directory
compilation terminated.

I found that there is no file name ws2tcpip.h in /usr/include directory

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:55:34+00:00Added an answer on June 9, 2026 at 11:55 am

    Take out the ./src/*.c, that tells gcc to compile all of the c programs in the /src directory which includes some windows only programs.

    What worked for me was to tell gcc to include the libmongoc.so that was built when the drivers were built.

    The following command worked for me. My drivers are in directory “mongo-c-driver”.

    gcc --std=c99 -I mongo-c-driver/src -o tutorial tutorial.c mongo-c-driver/libmongoc.so
    

    In my opinion the mongodb C API documentation is a little buggy in this area. Also, the latest header files don’t match the source code shown in the tutorial. For example mongo-insert requires 4 parameters in the v0.6 headers, but the tutorial shows only 2 parameters.

    In researching this problem and trying to recreate it by installing mongoDB and the C driver myself I have discovered that v0.6 of the driver broke compatibility with previous version of the API by adding support for write_concern which adds a 4th parameter to the mongo_insert function (which can be set to null). The example.c program provided in the docs/examples directory does not compile in v0.6. This bug is documented in patch CDRIVER-157 in github for the c-driver.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MongoDB for C#, I started following their tutorial but the compile error I get
I have successfully installed and run mongodb on my macbook pro with the c++
I compiled the following program with gcc -fprofile-arcs -ftest-coverage test.c: int main() { int
My compiled Go code does not end with an extension on Linux. Any tips
I compiled a x64 application in win32 development environment.. When I run that binary
I compiled a PHP extension on Fedora Core 12, but when I send it
This compiled on VS 2008, but it seems like non-standard usage of templates. template
I compiled the sqlite3 amalgamation into Android NDK, and I'm able to use it
I'm currently trying to compile a PHP driver for MongoDB using Visual Studio 2008
I was trying to compile the mongodbbackend module for powerdns but I'm stuck with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.