Please help linking C SDK library on Ubuntu
I just updated Couchbase Server to 2.0, and I think I have installed the 2.0 C SDK, but I still am not managing to link and build my C++ program - my g++ build command is apparently not finding libcouchbase, as it reports the libcouchbase types I try to use are not defined, and changing the name of my -lcouchbase linker parameter to something random results in the same error messages, which are:
In file included from GameEngine.h:24:0,
from GameEngine.cpp:26:
Database.h:45:3: error: ‘libcouchbase_t’ does not name a type
Database.h:46:3: error: ‘libcouchbase_error_t’ does not name a type
In file included from GameEngine.h:24:0,
from ProcessEvents.cpp:9:
Database.h:45:3: error: ‘libcouchbase_t’ does not name a type
Database.h:46:3: error: ‘libcouchbase_error_t’ does not name a type
In file included from GameEngine.h:24:0,
from ProcessMessages.cpp:9:
Database.h:45:3: error: ‘libcouchbase_t’ does not name a type
Database.h:46:3: error: ‘libcouchbase_error_t’ does not name a type
In file included from Database.cpp:8:0:
Database.h:45:3: error: ‘libcouchbase_t’ does not name a type
Database.h:46:3: error: ‘libcouchbase_error_t’ does not name a type
Database.cpp:12:3: error: variable or field ‘error_callback’ declared void
Database.cpp:12:3: error: ‘libcouchbase_t’ was not declared in this scope
Database.cpp:13:3: error: ‘libcouchbase_error_t’ was not declared in this scope
Database.cpp:14:3: error: expected primary-expression before ‘const’My build command, which works if I remove the libcouchbase types and the -libcouchbase parameter, is:
g++ -o ge GameEngine.cpp ProcessEvents.cpp ProcessMessages.cpp ../comms/SocketServer.cpp Database.cpp -lcouchbase
Relevant header code fragment:
#include <getopt.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <libcouchbase/couchbase.h>
class Database
{
...
// Data members:
protected:
libcouchbase_t instance; // our libcouchbase instance
libcouchbase_error_t oprc; // for checking various responses
...And my installation steps to get the Couchbase C 2.0 SDK installed was to try the Ubuntu install commands and also run dpkg -i on all of the deb packages (and to install the dependent libev4 from the Ubuntu Software Center):
libcouchbase2_2.0.2-416_amd64.deb libcouchbase2-backend_2.0.2-416_amd64.deb libcouchbase2-bin_2.0.2-416_amd64.deb libcouchbase2-core_2.0.2-416_amd64.deb libcouchbase2-libev_2.0.2-416_amd64.deb libcouchbase2-libevent_2.0.2-416_amd64.deb libcouchbase-dbg_2.0.2-416_amd64.deb libcouchbase-dev_2.0.2-416_amd64.deb
I am running Ubuntu 12.04.
Thanks for any help!
Dronz
Aha! Thank you so much, Sergey!
That was indeed the issue... that and my code being based on the C SDK 1.0 sample code. I see it has been rewritten a bit for the 2.0 C SDK, so I will refer to the new sample code and see if I can adapt it based on that to get through the next set of errors.
Thanks for getting me back on track!
Dronz
In libcouchbase 2.0 we've done some refactoring and part of these changes was renaming things from libcouchbase_* to lcb_*. Please revisit headers we are installing and upgrade your code appropriately.
Thank you
-- Sergey Avseyev
Find me on FreeNode IRC in #libcouchbase channel