UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2004-05-27 09:22 PM

hpdp
Member
From: Maryland
Registered: 2004-05-12
Posts: 11

Re: compiling errors

Offline

#2 2004-05-28 05:40 AM

Nope
Administrator
From: Germany
Registered: 2004-01-24
Posts: 385
Website

Re: compiling errors

You include several header files that in turn include obviously the original
header of "old" Blist. So you have indeed several definitions of the same
class in your program. I bet the other headers include a header for libops
and not a specific one for Blist.

Basically, as soon as you want to replace an already existing class or
function you have either to replace it systemwide or you have to give it a
slightly changed name. So if you really want to replace it you have to
replace it in libops.a and it's original header. So you need a copy of libops
in your folder, extract the old Blist and shove in your own one. If its
header is different you also have to adjust the original header in a local
copy of the header file it's a part of. Most likely there is a macro defined in
the original header file that prevents it from defining itself several times. If
you include your header and define the very same macro in there it might
also work. Or you also replace all other classes that rely on that one.

It's never a good idea to try that. As long as you don't have an own
definition of that class that is exactly copying the original one you will have
a lot problems if other classes/functions rely on that original behaviour.

Offline

#3 2004-05-28 11:36 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: compiling errors

I thought that namespaces were supposed to solve such problems. ;)

Offline

#4 2004-05-28 03:20 PM

hpdp
Member
From: Maryland
Registered: 2004-05-12
Posts: 11

Re: compiling errors

I need to modify the Blist class from the library directory. That's the reason I have one in my local directory. And it would be very hard to rename it, since it is called a lot by other classes.
I do use namespace in all the classes. They all have

namespace iret {
//class definition here
}

I thought the makefile tells which Blist to call. And it did work in similar situation before. Thank you.

Offline

#5 2004-05-28 06:56 PM

Nope
Administrator
From: Germany
Registered: 2004-01-24
Posts: 385
Website

Re: compiling errors

rofl. The only time I got similar errors was when I accidently loaded the
whole source file instead of the header one alone in a couple of modules.
So later at compile time the compiler couldn't decide which one was the
right one to take.

Under gcc I also had difficulties sometimes when a class contained code in
the body that was considered too big to be inline. So the compiler decided
to handle it like normal code outside the body creating basically the same
kind of multiple definition error. Perhaps it's something like that in your
case too.

The only way is to look at the files that are supposed to contain those
multiple copies and figure out how they got there. Look at the include
files and see if the one or other uses a path in one of its includes that
might work around your own include path definitions.

As it's a gcc problem you might want to take your question to a place that
exclusively deals with the compiler. There might be someone that knows a
lot more about this internal compiler stuff.

Offline

Board footer

Powered by FluxBB