Operating System - HP-UX
1825799 Members
2248 Online
109687 Solutions
New Discussion

Error while using C linker

 
Sujata_1
Occasional Contributor

Error while using C linker

Hello All,

I have a library 'A' written in C. This library has dependency on another library 'B' written in C++ and exposes some APIs which 'A' library uses. Now the problem is 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. Is there any linker flag that I should you use? Any workaround? My requirement is basically to use the C linker and not C++.

Any help is appreciated. Thanks in advance.

Sujata.
3 REPLIES 3
Steve Steel
Honored Contributor

Re: Error while using C linker

Hi


Seems like it is a 64 bit application . try removing the main

I seem to recall _main() should not be called for 64bit apps.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Sujata_1
Occasional Contributor

Re: Error while using C linker

Hi Steve,

Thanks for the response.
I am compiling code for 32-bit as well as 64-bit. Mine is a shared library. I am not calling main from anywhere.

Sujata.
ranganath ramachandra
Esteemed Contributor

Re: Error while using C linker

there is no separate linker for c++ on hpux.

if you want to build shared libraries from c++ code, you have to use the -b option of aCC. do not link it directly with ld.

as for the C compiler, you should make sure you use the ansi C compiler and not the bundled C compiler (which is there only to rebuild kernels).

the recent versions of ansi c compiler /opt/ansic/bin/cc also support the -b option. i dont think the bundled compiler does that.

if this does not work, please run the link again with LDOPTS set to -v (or -Wl,-v in the compiler command line) and post the output., along with the what string of the linker (output of "what /usr/ccs/bin/ld").
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo