Operating System - HP-UX
1834930 Members
2663 Online
110071 Solutions
New Discussion

Re: aCC link problem - 'Duplicate symbol'

 
Peter Godron
Honored Contributor

aCC link problem - 'Duplicate symbol'

S/w :
aCC: HP ANSI C++ B3910B A.03.30
ld: 92453-07 linker linker ld B.11.25 010129
On linking multiple objects together into an executable I get :
/usr/ccs/bin/ld: Duplicate symbol "sqlca" in files and < objectfile2>.
I believe there was a problem with duplicate linking??
Any help is greatly appreciated.
8 REPLIES 8
Umapathy S
Honored Contributor

Re: aCC link problem - 'Duplicate symbol'

hi Peter,
Duplicate Symbols represent definition of the variables done in more than two places.
Try to define it in one file and make that variable extern in another file. The best way is declare in a header file and include that header file in the source files.

Hope I am understanding the problem correctly.

cheers
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Adam J Markiewicz
Trusted Contributor

Re: aCC link problem - 'Duplicate symbol'

Why do I have impression you're working with ProC precompiler? ;)

Haven't touched it for ages. But as far as I remember there should be an option of the type of added code. One option was to use global objects (one of them was 'sqlca' - and that you must be using). I think the other was making the objects automatic on stack. This one should be used.

Good luck
Adam
I do everything perfectly, except from my mistakes
Peter Godron
Honored Contributor

Re: aCC link problem - 'Duplicate symbol'

The problem is not with the symbols. The same code compiles ok on 10.20 with ANSIc. The files are Pro*C programs, containing SQL;so removing the definition into one file is not an option.
Peter Godron
Honored Contributor

Re: aCC link problem - 'Duplicate symbol'

The problem is not with the symbols. The same code compiles ok on 10.20 with ANSIc. The files are Pro*C programs, containing SQL;so removing the definition into one file is not an option. I suspect the code is being loaded twice.
Adam J Markiewicz
Trusted Contributor

Re: aCC link problem - 'Duplicate symbol'

The problem IS with duplicate symbol. To be precise - with 'sqlca' object added by ProC.
The ANSIc on 10.20 handles problem with duplicate symbols differently.

Just pay more attention to my earlier advice about options in ProC.

Good luck
Adam


I do everything perfectly, except from my mistakes
Peter Godron
Honored Contributor

Re: aCC link problem - 'Duplicate symbol'

Solution:
Version of aCC 03.30 and its associated linker has a feature JAGad39135, where enums are made global.
Fix: Update to at least 03.33
Umapathy S
Honored Contributor

Re: aCC link problem - 'Duplicate symbol'

Never knew this Peter. Thanks for posting the solution to the forums.

Umapathy
Arise Awake and Stop NOT till the goal is Reached!
ranganath ramachandra
Esteemed Contributor

Re: aCC link problem - 'Duplicate symbol'

the new linker option "+allowdups" may help.
the symbol will resolve to the first symbol definition.
it is available with the latest linker (PHSS_28434/PHSS_28436 : B.11.36).
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo