compilation error

161 views
Skip to first unread message

Camilo Chacón Sartori

unread,
Jan 10, 2012, 5:23:09 PM1/10/12
to Hypertable Development
Hi all.
I downloaded the version 0.9.5.4 .I want integrate cppcms( C++ Web
Framework) and Hypertable.
What I want to compile, it show this compilation error:

-------------------------------------------------------------------------------

g++ -I/opt/hypertable/current/include/ hello.cpp -lcppcms -o hello.o

In file included from /usr/include/c++/4.6/backward/hash_map:61:0,
from /opt/hypertable/current/include/Common/HashMap.h:
24,
from /opt/hypertable/current/include/AsyncComm/
ApplicationQueue.h:34,
from /opt/hypertable/current/include/Hypertable/Lib/
Client.h:29,
from hello.cpp:15:

/usr/include/c++/4.6/backward/backward_warning.h:33:2: warning:
#warning This file includes at least one deprecated or antiquated
header which may be removed without further notice at a future date.
Please use a non-deprecated interface with equivalent functionality
instead. For a listing of replacement headers and interfaces, consult
the file backward_warning.h. To disable this warning use -Wno-
deprecated. [-Wcpp]

/tmp/ccjaPsNY.o: In function `main':

hello.cpp:(.text+0x2d9): undefined reference to
`Hypertable::System::locate_install_dir(char const*)'

hello.cpp:(.text+0x301): undefined reference to
`Hypertable::Client::Client(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, unsigned int)'

collect2: ld returned 1 exit status
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
Code:

#include <Common/Compat.h>

#include <cppcms/application.h>
#include <cppcms/applications_pool.h>
#include <cppcms/service.h>
#include <cppcms/http_response.h>
#include <cppcms/http_request.h>
#include <iostream>

#include <Common/Error.h>
#include <Common/System.h>

#include <Hypertable/Lib/Client.h>

using cppcms::http::request;
using namespace Hypertable;

class my_hello_world : public cppcms::application {
public:
my_hello_world(cppcms::service &srv) :
cppcms::application(srv)
{
}
virtual void main(std::string url);
};

void my_hello_world::main(std::string url)
{
response().out() << "Hello World";
}

int main(int argc,char ** argv)
{
ClientPtr client_ptr;
try {
const char* install_dir = "/opt/hypertable/current/";
client_ptr = new
Client( System::locate_install_dir( install_dir ) );

cppcms::service srv(argc,argv);

srv.applications_pool().mount(cppcms::applications_factory<my_hello_world>());
srv.run();
}
catch(std::exception const &e) {
std::cerr<<e.what()<<std::endl;
}
}

-------------------------------------------------------------------------------


Thank,
Camilo Chacón.

Doug Judd

unread,
Jan 11, 2012, 12:17:38 PM1/11/12
to hyperta...@googlegroups.com
Hi Camilo,

Here's a Makefile that we use to build our test program:

CC=g++
CFLAGS=-c -Wall -D_REENTRANT -I/opt/hypertable/current/include \
       -I/opt/hypertable/current/include/thrift
LDFLAGS=-rdynamic -L/opt/hypertable/current/lib -lHyperThrift \
        -lHyperCommon -lHypertable -lthrift -levent -llog4cpp

all: client_test

client_test: client_test.o
	$(CC) client_test.o $(LDFLAGS) -o client_test

client_test.o: client_test.cc
	$(CC) $(CFLAGS) client_test.cc

clean:
	rm -rf *o client_test

If you do something similar, that should solve your build problems.

- Doug


--
You received this message because you are subscribed to the Google Groups "Hypertable Development" group.
To post to this group, send email to hyperta...@googlegroups.com.
To unsubscribe from this group, send email to hypertable-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hypertable-dev?hl=en.


Camilo Chacón Sartori

unread,
Jan 12, 2012, 5:14:28 PM1/12/12
to Hypertable Development
Hi Doug,

I have compile error:
make

g++ client_test.o -rdynamic -L/opt/hypertable/current/lib -
lHyperThrift -lHyperCommon -lHypertable -lthrift -levent -llog4cpp -o
client_test

client_test.o: In function
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
apache::thrift::protocol::TMessageType, int)':
client_test.cc:
(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE17writeMessageBeginERKSsNS1_12TMessageTypeEi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::writeMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
apache::thrift::protocol::TMessageType, int)]+0x15): undefined
reference to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'
client_test.o: In function
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&,
apache::thrift::protocol::TMessageType&, int&)':
client_test.cc:
(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE16readMessageBeginERSsRNS1_12TMessageTypeERi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&,
apache::thrift::protocol::TMessageType&, int&)]+0x33): undefined
reference to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_MASK'
client_test.cc:
(.text._ZN6apache6thrift8protocol16TBinaryProtocolTINS0_9transport10TTransportEE16readMessageBeginERSsRNS1_12TMessageTypeERi[apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::readMessageBegin(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&,
apache::thrift::protocol::TMessageType&, int&)]+0x3d): undefined
reference to
`apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>::VERSION_1'

collect2: ld returned 1 exit status
make: *** [client_test] Error 1


Thank.


On 11 ene, 14:17, Doug Judd <d...@hypertable.com> wrote:
> Hi Camilo,
>
> Here's a Makefile that we use to build our test program:
>
> CC=g++
> CFLAGS=-c -Wall -D_REENTRANT -I/opt/hypertable/current/include \
>        -I/opt/hypertable/current/include/thrift
> LDFLAGS=-rdynamic -L/opt/hypertable/current/lib -lHyperThrift \
>         -lHyperCommon -lHypertable -lthrift -levent -llog4cpp
>
> all: client_test
>
> client_test: client_test.o
>         $(CC) client_test.o $(LDFLAGS) -o client_test
>
> client_test.o: client_test.cc
>         $(CC) $(CFLAGS) client_test.cc
>
> clean:
>         rm -rf *o client_test
>
> If you do something similar, that should solve your build problems.
>
> - Doug
>
> On Tue, Jan 10, 2012 at 2:23 PM, Camilo Chacón Sartori
> <camilo...@gmail.com>wrote:

Doug Judd

unread,
Jan 12, 2012, 5:16:49 PM1/12/12
to hyperta...@googlegroups.com
Make sure you're building against the same version of Thrift that we build against (0.7.0).

- Doug
Reply all
Reply to author
Forward
0 new messages