Lcb_version_g variable not being set?


#1

Hello,

Is there an issue with this code or with the C library? Can’t think of a reason why the second printf doesn’t spit the version out. Does this work differently on another platform?

#include <stdio.h>
#include <libcouchbase/couchbase.h>

int main(int argc, char **argv)
{
printf(“lcb_get_version = %s\n”, lcb_get_version(NULL));
printf(“lcb_version_g = %u\n”, lcb_version_g );

return 0;

}

And the output:
$ ./a.out
lcb_get_version = 2.6.1
lcb_version_g = 0

Link to lcb_version_g definition in the online documentation:
http://docs.couchbase.com/sdk-api/couchbase-c-client-2.6.1/group__lcb-build-info.html#gac1d0fc4a92d26b4d58d1ec2d9c92cb13

Thanks.


#2

The formatting killed my includes:

include < stdio.h >

include < libcouchbase/couchbase.h >


#3

What OS are you using, and how are you linking against the library?

#include <libcouchbase/couchbase.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    printf("lcb_version_g=%lu\n", lcb_version_g);
    return 0;
}
lcb_version_g=132609

#4

Sorry, forgot to include the obvious. It’s on OS X 10.11.5.

$ gcc -o testVersion testVersion.c -lcouchbase

This is not the libcouchbase from homebrew but a locally compiled version from the libcouchbase-2.6.1.tar.gz package.

$ cbc version
cbc:
Runtime: Version=2.6.1, Changeset=0xdeadbeef
Headers: Version=2.6.1, Changeset=0xdeadbeef
IO: Default=libevent, Current=libevent
SSL: … SUPPORTED


#5

Are you sure you’re using one compiled from the downloaded tarball, or is this one you obtained from GitHub? The build scripts rely that the tarball used is either one generated from make dist (from a Git repository) or from the git repository tree itself. Internal scripts use git describe to derive the current version information (based on Git tags)