Operating System - HP-UX
1828993 Members
2411 Online
109986 Solutions
New Discussion

Duplicate symbol error with aCC and shared libraries.

 
RAMAKRISHNA SREEDHARA
Occasional Advisor

Duplicate symbol error with aCC and shared libraries.

Hi,

I am trying to build a shared library using aCC with 2 files both containing main function.

aCC +z -c a.c
aCC +z -c b.c

aCC -b -o libr.sl *.o - On this , I get error that duplicate symbols are not allowed in shared libraries. Does this mean that we cannot have 2 main calls in one library. Static libraries do allow. my scenario is b.c has some functions that be used by a.c.

Any suggestions....

Thanks
Rama
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Duplicate symbol error with aCC and shared libraries.

You can't do this, why would you want to do so?
shared libs are NOT archive libs.

>Does this mean that we cannot have 2 main calls

You can't have duplicate definitions.

>my scenario is b.c has some functions that be used by a.c.

Delete the duplicate main function.