Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

something about link errow : undefined reference to `ACE_Log_Msg::last_error_adapter()' newbie

187 views
Skip to first unread message

ppms...@gmail.com

unread,
Apr 12, 2006, 3:23:33 AM4/12/06
to
hi all
i just install ace for my linux centos 4.0 i can not sure it success.

what i do

1. tar -xzvf ACE+TAO+CIAO.tar.gz

2.cd ACE_wrappers

3.export ACE_ROOT="/home/aaa/ACE_wrappers"

4.cd $ACE_ROOT/ace

ln -s config-linux.h config.h

5.cd $ACE_ROOT/include/makeinclude
ln -s platform_linux.GNU platform_macros.GNU

6.cd $ACE_ROOT
make

....after long time . it success. ??

is it success?

i can find $ACE_ROOT/ace/

./ace/libACE.so ./ace/libACE.so.5.5.0

i try to complier the cpp file

/***********************
main.cpp
**************************/

#include "ace/SOCK_Acceptor.h"
#include "ace/SOCK_Stream.h"
#include "ace/Log_Msg.h"
#include "ace/Init_ACE.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
#include "ace/Acceptor.h"

#define SIZE_DATA 18
#define SIZE_BUF 1024
#define NO_ITERATIONS 5

//#define ACE_HAS_TOKENS_LIBRARY

class Server
{
public:
Server (int port): server_addr_(port),peer_acceptor_(server_addr_)
{
data_buf_= new char[SIZE_BUF];
}
//Handle the connection once it has been established. Here the
//connection is handled by reading SIZE_DATA amount of data from the
//remote and then closing the connection stream down.
int handle_connection()
{
// Read data from client
for(int i=0;i<NO_ITERATIONS;i++)
{
int byte_count=0;
if( (byte_count=new_stream_.recv_n (data_buf_, SIZE_DATA, 0))==-1)
ACE_ERROR ((LM_ERROR, "%p\n", "Error in recv"));
else
{
data_buf_[byte_count]=0;
ACE_DEBUG((LM_DEBUG,"Server received %s \n",data_buf_));
}
}
// Close new endpoint
if (new_stream_.close () == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "close"));
return 0;
}
//Use the acceptor component peer_acceptor_ to accept the connection
//into the underlying stream new_stream_. After the connection has been
//established call the handle_connection() method.
int accept_connections ()
{
if (peer_acceptor_.get_local_addr (server_addr_) == -1)
ACE_ERROR_RETURN ((LM_ERROR,"%p\n","Error in get_local_addr"),1);
ACE_DEBUG ((LM_DEBUG,"Starting server at port %d\n",
server_addr_.get_port_number ()));

// Performs the iterative server activities.
while(1)
{
ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT);
if (peer_acceptor_.accept (new_stream_, &client_addr_, &timeout)== -1)
{
ACE_ERROR ((LM_ERROR, "%p\n", "accept"));
continue;
}
else
{
ACE_DEBUG((LM_DEBUG,
"Connection established with remote %s:%d\n",
client_addr_.get_host_name(),client_addr_.get_port_number()));
//Handle the connection
handle_connection();
}
}
}
private:
char *data_buf_;
ACE_INET_Addr server_addr_;
ACE_INET_Addr client_addr_;
ACE_SOCK_Acceptor peer_acceptor_;
ACE_SOCK_Stream new_stream_;
};
int main (int argc, char *argv[])
{
if(argc<2)
{
ACE_ERROR((LM_ERROR,"Usage %s <port_num>", argv[0]));
ACE_OS::exit(1);
}
Server server(ACE_OS::atoi(argv[1]));
server.accept_connections();
return 0;
}

/*********************
end
*************************/

this file can complier scucces in VC7.1 .


g++ main.cpp -I$ACE_ROOT -L$ACE_ROOT
main.cpp:92:2: warning: no newline at end of file
/tmp/cc8ZPC0i.o(.text+0x24): In function `main':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.text+0x2c): In function `main':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.text+0x46): In function `main':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.text+0x60): In function `main':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.text+0x6d): In function `main':
: undefined reference to `ACE_OS::exit(int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerD1Ev+0x36): In function
`Server::~Server()':
: undefined reference to `ACE_INET_Addr::~ACE_INET_Addr()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerD1Ev+0x50): In function
`Server::~Server()':
: undefined reference to `ACE_INET_Addr::~ACE_INET_Addr()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerD1Ev+0x70): In function
`Server::~Server()':
: undefined reference to `ACE_INET_Addr::~ACE_INET_Addr()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x18):
In function `Server::accept_connections()':
: undefined reference to `ACE_SOCK::get_local_addr(ACE_Addr&) const'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x25):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x2d):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x47):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x61):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x75):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x7d):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x97):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0xbf):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0xfa):
In function `Server::accept_connections()':
: undefined reference to `ACE_SOCK_Acceptor::accept(ACE_SOCK_Stream&,
ACE_Addr*, ACE_Time_Value*, int, int) const'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x107):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x10f):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x129):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x143):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x150):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x158):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x172):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x19a):
In function `Server::accept_connections()':
: undefined reference to `ACE_INET_Addr::get_host_name() const'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server18accept_connectionsEv+0x1ad):
In function `Server::accept_connections()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x47):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x4f):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x69):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x83):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x98):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0xa0):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0xba):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0xd1):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0xed):
In function `Server::handle_connection()':
: undefined reference to `ACE_SOCK_Stream::close()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0xfa):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::last_error_adapter()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x102):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::instance()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x11c):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::conditional_set(char const*,
int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6Server17handle_connectionEv+0x136):
In function `Server::handle_connection()':
: undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char
const*, ...)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN3ACE6recv_nEiPvjiPK14ACE_Time_ValuePj+0x1f):
In function `ACE::recv_n(int, void*, unsigned int, int, ACE_Time_Value
const*, unsigned int*)':
: undefined reference to `ACE::recv_n_i(int, void*, unsigned int, int,
unsigned int*)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN3ACE6recv_nEiPvjiPK14ACE_Time_ValuePj+0x41):
In function `ACE::recv_n(int, void*, unsigned int, int, ACE_Time_Value
const*, unsigned int*)':
: undefined reference to `ACE::recv_n_i(int, void*, unsigned int, int,
ACE_Time_Value const*, unsigned int*)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN14ACE_Time_Value3setEll+0x1e): In
function `ACE_Time_Value::set(long, long)':
: undefined reference to `ACE_Time_Value::normalize()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerC1Ei+0x1b): In function
`Server::Server(int)':
: undefined reference to `ACE_INET_Addr::ACE_INET_Addr(unsigned short,
unsigned int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerC1Ei+0x2d): In function
`Server::Server(int)':
: undefined reference to `ACE_INET_Addr::ACE_INET_Addr()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerC1Ei+0x4e): In function
`Server::Server(int)':
: undefined reference to `ACE_SOCK_Acceptor::ACE_SOCK_Acceptor(ACE_Addr
const&, int, int, int, int)'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerC1Ei+0xcf): In function
`Server::Server(int)':
: undefined reference to `ACE_INET_Addr::~ACE_INET_Addr()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN6ServerC1Ei+0xec): In function
`Server::Server(int)':
: undefined reference to `ACE_INET_Addr::~ACE_INET_Addr()'
/tmp/cc8ZPC0i.o(.gnu.linkonce.t._ZN11ACE_SOCK_IOC2Ev+0xd): In function
`ACE_SOCK_IO::ACE_SOCK_IO()':
: undefined reference to `ACE_SOCK::ACE_SOCK()'
collect2: ld returned 1 exit status

i don't know how to fix the problem

hminute

unread,
Apr 12, 2006, 10:02:05 PM4/12/06
to
You can write your makefile ,as follow:

BIN = main
SRC = $(addsuffix .cpp,$(BIN))
BUILD = $(VBIN)
include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
include $(ACE_ROOT)/include/makeinclude/rules.local.GNU

Then make.

Message has been deleted

papamms

unread,
Apr 13, 2006, 2:49:19 AM4/13/06
to
thanks i use the command

g++ main.cpp -I$ACE_ROOT -L$ACE_ROOT
errow!

if i use g++ main.cpp -I$ACE_ROOT -L$ACE_ROOT -c
success.

so i think it is some problem in link object.

hminute

unread,
Apr 13, 2006, 3:28:03 AM4/13/06
to
what does using "-c" mean?

papamms

unread,
Apr 13, 2006, 3:30:46 AM4/13/06
to
compile only no link

baradhi...@gmail.com

unread,
Mar 22, 2020, 5:55:18 AM3/22/20
to
I've tried the same , this creates a file main.o but ./main.o doesnt work
0 new messages