Operating System - Tru64 Unix
1828670 Members
2145 Online
109984 Solutions
New Discussion

Error while using C linker

 
Sujata_1
Occasional Contributor

Error while using C linker

Hello All,

I have a shared library 'A' written in C. This library has dependency on another shared library 'B' written in C++ and exposes some APIs which 'A' library uses. Now the problem is that if I use the C++ linker, thinks work fine. But if I use C linker, then I get the following error,
ld: Unsatisfied symbol "main" in file
1 errors.

I am using HP-11.00 RISC with aCC 3.37 compiler and OSF 5.1 CPQ 6.5 compiler. Is there any linker flag that I should use? Any workaround? My requirement is basically to use the C linker and not C++.
I don't have main implemented in both the libraries.

Any help is appreciated. Thanks in advance.

Sujata.
1 REPLY 1
Cristiano MESSINA
New Member

Re: Error while using C linker

Hi,

from the error it seems to miss the option when try to create other
Shared. To create a shared library from one or more object files use the -b option at link time.

For examples:
aCC -b -o MyShared.sl Func1.o Func2.o

In every case, the C++ compiler must know that f(int,char,float) is to be called by a C compiler using the extern C construct.

Best Regards,
Cristiano