cmongodbzeromqmongodb-c

MongoDB, ZeroMQ and C


i'm with a great problem,

i have some code using ZeroMQ and C, and another code that uses MongoDB and C, now i have to merge this codes, but when i try to compile using this command:

gcc -static -lzmq -o logg logger.c /home/lis/mongo-c-driver/libmongoc.a

i got this error stack:

In file included from /usr/local/include/mongo.h:24:0,
                 from write_log.h:13,
                 from get_by_log_code.h:6,
                 from logger.c:23:
/usr/local/include/bson.h:63:2: error: #error Must compile with c99 or define MONGO_HAVE_STDINT, MONGO_HAVE_UNISTD, MONGO_USE__INT64, or MONGO_USE_LONG_INT.
In file included from get_by_log_code.h:6:0,
                 from logger.c:23:
write_log.h: In function ‘write_log’:
write_log.h:70:2: error: incompatible type for argument 1 of ‘mongo_insert’
/usr/local/include/mongo.h:369:18: note: expected ‘struct mongo *’ but argument is of type ‘mongo’
write_log.h:70:2: error: too few arguments to function ‘mongo_insert’
/usr/local/include/mongo.h:369:18: note: declared here

When i installed the Mongo-C-Driver:

i've used make STD=c89, to resolve the conflict between, MongoDB-C-api and ZeroMQ-C-api, in my logger.c file i've defined the variables that error stack asks, but it doesn't works.


Solution

  • You should be using --std=c99

    c89 is a valid older standard too, which is why you're getting the error.