|
|||
Multiple Symbols conflict with C++ Library ClosureA multiple symbol definition conflict can occur using nmake with Lucent C++ 4.x and the Library Closure Rule. The problem is rare, and occurs as follows. Suppose the following situation:
liba.a :: a.c
libb.a :: b.c -la
libc.a :: c.c -lb -la
target :: main.c -lc -lb -la
c.c contains a List<a> so during the library closure a list of a is instantiated and added to c.o.
C++ prelinker: lnnk_ATTLC<a>::pool assigned to file c.o
C++ prelinker: lnnk_ATTLC<a>::copy() assigned to file c.o
C++ prelinker: lnnk_ATTLC<a>::operator ==(lnk_ATTLC &) assigned to file c.o
C++ prelinker: lnnk_ATTLC<a>::~lnnk_ATTLC<A>() assigned to file c.o
This works fine. Suppose after some period of time somebody adds a list<a> to b.c without modifying a .h file. During the compilation a list<a> is instantiated and added to b.o. libc.a is not revisited since there is no dependency on b in its implementation. During the linking phase of the target a multiple symbols definition will occur:
ild: (Performing full relink) symbol definitions conflict [...]
ild: lnnk_ATTLC<a>::operator new(unsigned int) is defined in files b.o and c.o
ild: lnnk_ATTLC<a>::pool is defined in files b.o and c.o
ild: typeinfo for lnnk_ATTLC<a> is defined in files b.o and c.o
ild: lnnk_ATTLC<a>::operator ==(lnk_ATTLC &) is defined in files b.o and c.o
ild: lnnk_ATTLC<a>::copy() is defined in files b.o and c.o
ild: lnnk_ATTLC<a>::~lnnk_ATTLC<a>() is defined in files b.o and c.o
ild: virtual function table for lnnk_ATTLC<a> is defined in files b.o and c.o
ild: exiting because of errors in link
The only way to overcome this is to use the -F flag after this situation has occured. This will force everything to rebuild and relink appropriately. If another, better solution is found it will be posted here. Last Update: Wednesday,20-Dec-06 13:21:56 CST
|
|||