1825659 Members
3663 Online
109686 Solutions
New Discussion

Linking problem

 
SOLVED
Go to solution
astra
Frequent Advisor

Linking problem

Hi,

I am trying to make binary for using some library but getting linking error.

command:
/opt/aCC/bin/aCC -I. +test.c -L/usr/lib/ -L/opt/OC/lib/hpux32/ -l M3UAOamAPIWBB.
=======
o/p:
/usr/ccs/bin/ld -z -o a.out -u___exit -umain -L/opt/aCC/lib/hpux32 test.o -L /usr/lib/ -L /opt/OC/lib/hpux32/ -lTTL -lM3UAOamAPIWBB -lstd_v2 -lCsup -lpthread -lm -lunwind -lCsup -lc -ldl >/var/tmp/AAAa18375 2>&1
/opt/aCC/bin/c++filt &2
ld: Unsatisfied symbol "M3UA_oamcmd(int,int,timeval*,void*,M3uaOamObject,int*,M3uaOamCmd,M3uaCmdParms*)" in file test.o
1 errors.
removing /var/tmp/AAAa18375
=======

I checked that may be function is not defind in that library so I am geeting error.
so I checked that library file and found:

when i use nm comand for finding this procedure in /opt/OC/lib/hpux32/ and found
bash-2.05b# nm *.so|grep M3UA_oamcmd
nm: libTTLIntf.so: cannot open
[265] | 67635600| 8528|FUNC |GLOB |0| .text|M3UA_oamcmd
[265] | 67635600| 8528|FUNC |GLOB |0| .text|M3UA_oamcmd
[265] | 67635600| 8528|FUNC |GLOB |0| .text|M3UA_oamcmd
[265] | 67635600| 8528|FUNC |GLOB |0| .text|M3UA_oamcmd
bash-2.05b#

When function def is present why in linking it is throwing error.
Expert ant comments on ??

TIA
-Amit
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: Linking problem

>-L/usr/lib/

Remove this. There should be NO IPF shlibs in this path. This is for PA32 only.

>ld: Unsatisfied symbol M3UA_oamcmd(int,int,timeval*,void*,M3uaOamObject,int*,M3uaOamCmd,M3uaCmdParms*)

This is a C++ mangled name.

>FUNC |GLOB |0| .text|M3UA_oamcmd

This is a C name.

>When function def is present why in linking it is throwing error?

If your definition is C, you must declare it as:
extern "C" void? M3UA_oamcmd(int,int,timeval*,void*,M3uaOamObject,int*,M3uaOamCmd,M3uaCmdParms*)
astra
Frequent Advisor

Re: Linking problem

Hi,

Thanks

But I am not getting this

========
If your definition is C, you must declare it as:
extern "C" void? M3UA_oamcmd(int,int,timeval*,void*,M3uaOamObject,int*,M3uaOamCmd,M3uaCmd
Parms*)
===============================
Please clarified more.

And one more thing both the thing is provied by HP, Is any work around to make binary in this case.I ha.ve to use this system call but i can not able to make binary

Regard,
Amit


Dennis Handly
Acclaimed Contributor
Solution

Re: Linking problem

>But I am not getting this:

(This should now be obvious and a light should have appeared above your head. :-)

========
If your definition is C, you must declare it as:
extern "C" void? M3UA_oamcmd(int, int, timeval*, void*, M3uaOamObject, int*, M3uaOamCmd, M3uaCmdParms*)
===============================

>Please clarified more.

What language is M3UA_oamcmd written?
test.o is in C++. If you want C++ to call C, you must declare the functions, types and data in an extern "C" block. (Or use extern "C" before each function.)

>the thing is provided by HP, Is any work around to make binary in this case. I have to use this system call but i can not able to make binary

Where is your header that declares M3UA_oamcmd? You need to edit it (C++ify it.)
astra
Frequent Advisor

Re: Linking problem

Thanks,
Resloved issue.

-Amit
astra
Frequent Advisor

Re: Linking problem

got solution