withmongo-c-driver-1.1.0 , we got error: mongoc.h: No such file or director

364 views
Skip to first unread message

hardik chauhan

unread,
Jul 21, 2015, 8:59:48 AM7/21/15
to mongo...@googlegroups.com
anY HELP
system info :
=== 
centos 6.6 
mongo-c-driver-1.1.0
/usr/src/mongo-c-driver-1.1.0/src/mongoc
=====
issue : 
test.c:18:20: error: mongoc.h: No such file or directory 
=====
[root@web mongoc]# gcc CFLAGS=-std=c99 test.c 192.168.0.181 27017 -o test.o
gcc: CFLAGS=-std=c99: No such file or directory
gcc: 192.168.0.181: No such file or directory
gcc: 27017: No such file or directory
test.c:18:20: error: mongoc.h: No such file or directory
test.c: In function ‘main’:
test.c:26: error: ‘mongoc_database_t’ undeclared (first use in this function)
test.c:26: error: (Each undeclared identifier is reported only once
test.c:26: error: for each function it appears in.)
test.c:26: error: ‘database’ undeclared (first use in this function)
test.c:27: error: ‘mongoc_cursor_t’ undeclared (first use in this function)


===

Hannes Magnusson

unread,
Jul 22, 2015, 12:42:47 PM7/22/15
to mongodb-dev
You need to tell gcc where you installed mongoc.
We recommend using pkg-config, if your platform supports it. Try something like:

$ gcc -o test test.c $(pkg-config --cflags --libs libmongoc-1.0)

Checkout our documentations on http://api.mongodb.org/c/current/
The getting started guide should be helpful, it has complete examples including how to build and run them: http://api.mongodb.org/c/current/inserting-document.html

Also note that the 1.1.0 release is fairly old -- I'd strongly recommend you upgrade to 1.1.10.

-Hannes

Reply all
Reply to author
Forward
0 new messages