[chord] Linking the example C++ code
Chris Wailes
cwailes2 at uiuc.edu
Wed Nov 21 22:04:25 EST 2007
Hello all. I just started working with the Chord code today, and everything seems to be going well. The only problem I'm having is when I try and link the example C++ interface code. I saw that there was a similar issue previously in this mailing list (May 2005) but from what I could tell I have done everything suggested to solve the problem with no results. Bellow are the exact code, Makefile and errors that I'm getting. Any help would be greatly appreciated.
Sincerely,
Chris Wailes
CODE:
#include <async.h>
#include <string.h>
#include <dhash_prot.h>
#include <dhashclient.h>
void cb (dhash_stat status, ptr<insert_info> i) {
exit (!(status == DHASH_OK));
}
int main(int argc, char** argv) {
ptr<dhashclient> dhash = New refcounted<dhashclient> ("/usr/local/sdcs/dhash/lsd-sock");
dhash->insert("Hello World", strlen("Hello World"), wrap(&cb));
amain ();
}
MAKEFILE:
INCLUDES = -I /usr/local/include/sfslite-0.8 -I /usr/local/include/chord-0.1
LINK_FOLDERS = -L /usr/local/lib/chord-0.1/ -L /usr/local/lib/sfslite-0.8/ -L /usr/lib
LINKS = -l dhashclient -l async -l resolv
test: test.o
g++ $(LINK_FOLDERS) $(LINKS) -o $@ $<
test.o: test.C
g++ $(INCLUDES) -c $<
ERRORS:
g++ -L /usr/local/lib/chord-0.1/ -L /usr/local/lib/sfslite-0.8/ -L /usr/lib -l dhashclient -l async -l resolv -o test test.o
test.o: In function `main':
test.C:(.text+0x19d): undefined reference to `dhashclient::insert(char const*, unsigned int, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>)'
test.C:(.text+0x1e8): undefined reference to `amain()'
test.o: In function `__globaldestruction_t::~__globaldestruction_t()':
test.C:(.text._ZN21__globaldestruction_tD1Ev[__globaldestruction_t::~__globaldestruction_t()]+0x5): undefined reference to `__globaldestruction_t::started'
test.o: In function `strobj::strobj()':
test.C:(.text._ZN6strobjC1Ev[strobj::strobj()]+0xe): undefined reference to `strobj_opdel'
test.o: In function `async_init::cnt()':
test.C:(.text._ZN10async_init3cntEv[async_init::cnt()]+0x4): undefined reference to `async_init::count'
test.o: In function `async_init::async_init()':
test.C:(.text._ZN10async_initC1Ev[async_init::async_init()]+0x1f): undefined reference to `async_init::start()'
test.o: In function `async_init::~async_init()':
test.C:(.text._ZN10async_initD1Ev[async_init::~async_init()]+0x1e): undefined reference to `async_init::stop()'
test.o: In function `refcounted<dhashclient, (reftype)0>::refcounted<char [31]>(char const (&) [31])':
test.C:(.text._ZN10refcountedI11dhashclientL7reftype0EEC1IA31_cEERKT_[refcounted<dhashclient, (reftype)0>::refcounted<char [31]>(char const (&) [31])]+0x3a): undefined reference to `dhashclient::dhashclient(str)'
collect2: ld returned 1 exit status
make: *** [test] Error 1
More information about the chord
mailing list