Hi there,
I am trying to build a very basic UDP program, and compiling it happens to be a problem.
source is something like :
#include <cc++/socket.h>
#include <iostream.h>
#include <stdlib.h>
#include "calc_udp.h"
#define PORT 5678
class myUDPSocket : public UDPSocket{
public:
myUDPSocket(InetAddress &ia); };
myUDPSocket::myUDPSocket(InetAddress &ia) : UDPSocket(ia, PORT) {};
int main()
{
calc_datagram datagram;
InetAddress addr;
addr = "127.0.0.1";
try{
myUDPSocket server(addr);
while(1){
if( sizeof(datagram) == server.Recv(& datagramme,sizeof(datagram) ) ){
switch( datagram.op ) {
case '+': datagramme.result=datagramme.a+datagramme.b ;
break;
...etc
}
server.Send(& datagramme,sizeof(datagramme));
...
compilation by :
gcc -pthread -ldl -o a.out servUDPcc++.o -lm -lz -lccxx -lstdc++
with following flags :
-D_REENTRANT -D_THREAD_SAFE -O2 -fsigned-char -D_GNU_SOURCE
And errors are :
servUDPcc++.o: In function `myUDPSocket::~myUDPSocket(void)':
/usr/local/include/cc++/socket.h(.text+0x18): undefined reference to `cc_UDPSocket::cc_UDPSocket(cc_InetAddress const &, unsigned short)'
servUDPcc++.o: In function `main':
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:28: undefined reference to `cc_InetAddress::operator=(char const *)'
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:29: undefined reference to `operator<<(ostream &, cc_InetAddress const &)'
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:52: undefined reference to `cc_Socket type_info node'
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:54: undefined reference to `cc_TCPStream type_info node'
servUDPcc++.o: In function `myUDPSocket::~myUDPSocket(void)':
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf12cc_UD
Socket+0x10): undefined reference to `cc_Socket type_info function'
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf12cc_UDPSocket+0x1a): undefined reference to `cc_Socket type_info node'
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf12cc_TCPSocket+0x10): undefined reference to `cc_Socket type_info function'
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf9tcpstream+0x10): undefined reference to `cc_TCPStream type_info function'
Can anybody help ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First, the link order should be -lccstd -lccio -lccxx -lz and then followed by any thread libs. Also, you must compile with -rtti. The "typeinfo node" error usually means the library and the application were compiled under different rtti settings.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2000-11-28
I'm affraid this did not solve the problem.
Here is main part of my Makefile :
MYCODEDIR := .
CC++DIR := usr/local/include
SEARCHDIRS := -I- -I${MYCODEDIR} -I${CC++DIR}
DEPENDFLAGS := -g -D_REENTRANT -D_THREAD_SAFE -O2 -fsigned-char -D_GNU_SOURCE -rtti ${SEARCHDIRS}
CPPFLAGS =
CC := gcc
CFLAGS = ${DEPENDFLAGS}
%.o : %.cpp
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c $< -o $@
LINKER := gcc
LDFLAGS = -ldl
LOADLIBES := -lm -lccstd -lccio -lccxx -lz -pthread
a.out : ./servUDPcc++.o
${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES}
I'm affraid Iam not really aware about rtti settings problems...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2000-11-30
At the moment, my only solution for compiling is to insert my file in the demo directory, and to modify the ./configure created makefile with my prog's name ;-(
Thanx for helping
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am having the same linker problem i have tried many possibliliy passing lib parameter lib paramter to g++ flags but nothing works
./configure --prefix=/usr
make
make install
all this does not work and david and guys work in a simplified makefiles and ./configuration.
thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
I am trying to build a very basic UDP program, and compiling it happens to be a problem.
source is something like :
#include <cc++/socket.h>
#include <iostream.h>
#include <stdlib.h>
#include "calc_udp.h"
#define PORT 5678
class myUDPSocket : public UDPSocket{
public:
myUDPSocket(InetAddress &ia); };
myUDPSocket::myUDPSocket(InetAddress &ia) : UDPSocket(ia, PORT) {};
int main()
{
calc_datagram datagram;
InetAddress addr;
addr = "127.0.0.1";
try{
myUDPSocket server(addr);
while(1){
if( sizeof(datagram) == server.Recv(& datagramme,sizeof(datagram) ) ){
switch( datagram.op ) {
case '+': datagramme.result=datagramme.a+datagramme.b ;
break;
...etc
}
server.Send(& datagramme,sizeof(datagramme));
...
compilation by :
gcc -pthread -ldl -o a.out servUDPcc++.o -lm -lz -lccxx -lstdc++
with following flags :
-D_REENTRANT -D_THREAD_SAFE -O2 -fsigned-char -D_GNU_SOURCE
And errors are :
servUDPcc++.o: In function `myUDPSocket::~myUDPSocket(void)':
/usr/local/include/cc++/socket.h(.text+0x18): undefined reference to `cc_UDPSocket::cc_UDPSocket(cc_InetAddress const &, unsigned short)'
servUDPcc++.o: In function `main':
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:28: undefined reference to `cc_InetAddress::operator=(char const *)'
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:29: undefined reference to `operator<<(ostream &, cc_InetAddress const &)'
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:52: undefined reference to `cc_Socket type_info node'
/home/phil/Reseau/UDPCC++/servUDPcc++.cpp:54: undefined reference to `cc_TCPStream type_info node'
servUDPcc++.o: In function `myUDPSocket::~myUDPSocket(void)':
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf12cc_UD
Socket+0x10): undefined reference to `cc_Socket type_info function'
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf12cc_UDPSocket+0x1a): undefined reference to `cc_Socket type_info node'
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf12cc_TCPSocket+0x10): undefined reference to `cc_Socket type_info function'
/usr/local/include/cc++/socket.h(.gnu.linkonce.t.__tf9tcpstream+0x10): undefined reference to `cc_TCPStream type_info function'
Can anybody help ?
First, the link order should be -lccstd -lccio -lccxx -lz and then followed by any thread libs. Also, you must compile with -rtti. The "typeinfo node" error usually means the library and the application were compiled under different rtti settings.
I'm affraid this did not solve the problem.
Here is main part of my Makefile :
MYCODEDIR := .
CC++DIR := usr/local/include
SEARCHDIRS := -I- -I${MYCODEDIR} -I${CC++DIR}
DEPENDFLAGS := -g -D_REENTRANT -D_THREAD_SAFE -O2 -fsigned-char -D_GNU_SOURCE -rtti ${SEARCHDIRS}
CPPFLAGS =
CC := gcc
CFLAGS = ${DEPENDFLAGS}
%.o : %.cpp
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c $< -o $@
LINKER := gcc
LDFLAGS = -ldl
LOADLIBES := -lm -lccstd -lccio -lccxx -lz -pthread
a.out : ./servUDPcc++.o
${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES}
I'm affraid Iam not really aware about rtti settings problems...
At the moment, my only solution for compiling is to insert my file in the demo directory, and to modify the ./configure created makefile with my prog's name ;-(
Thanx for helping
I'm having same problem too.
How you change ./configure ???
regards,
April
I am having the same linker problem i have tried many possibliliy passing lib parameter lib paramter to g++ flags but nothing works
./configure --prefix=/usr
make
make install
all this does not work and david and guys work in a simplified makefiles and ./configuration.
thanks.