1

I want to use libmongoc for my C program but whenever I try to establish a connection to my cloud database, it shows an error:

/usr/local/include/libmongoc-1.0/mongoc/mongoc.h:22:10: fatal error: bson/bson.h: No such file or directory
   22 | #include <bson/bson.h>
      |          ^~~~~~~~~~~~~

Any fix for this? I installed libmongoc and even libbson using these docs: http://mongoc.org/libmongoc/current/installing.html

But it doesnt seem to work. Any help would be appreciated.

I am using Ubuntu 20.04.1 and libmongoc 1.17.3

Edit: I got to know the error. the path to the bson.h file is wrong but somehow i cannot edit the file. Is there any workaround?

lakshya
  • 105
  • 3
  • 9
  • You are not failing to connect to the DB, but already failing to compile the relevant code. From here http://mongoc.org/libmongoc/current/installing.html one learns that "*The only prerequisite for building libbson is `cmake`.*". – alk Dec 31 '20 at 17:37
  • i actually found something.. i checked that in the mongoc.h file the path to bson.h file is wrong. it exists elsewhere but somehow i cant save changes to that file. Is there anything about that? – lakshya Dec 31 '20 at 17:41
  • Use the compiler `-I` flag to specify where it should search for headers. – Manuel Dec 31 '20 at 17:44

0 Answers0