Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

Please help linking C SDK library on Ubuntu

2 replies [Last post]
  • Login or register to post comments
Wed, 01/23/2013 - 18:07
Dronz
Offline
Joined: 09/17/2011
Groups: None

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

Top
  • Login or register to post comments
Thu, 01/24/2013 - 00:19
avsej
avsej's picture
Offline
Joined: 06/15/2011
Groups: None

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

Top
  • Login or register to post comments
Sun, 01/27/2013 - 19:38
Dronz
Offline
Joined: 09/17/2011
Groups: None

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

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker