public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Gcc Compile and link
@ 2002-04-02  0:59 Simon, Christine
  0 siblings, 0 replies; 2+ messages in thread
From: Simon, Christine @ 2002-04-02  0:59 UTC (permalink / raw)
  To: help-gcc

Hello,

I'm a "fresh" G++ ( and also C++) Programmer and have a problem  when compiling a program that needs to use XML libraries.

I work on a UNIX-AIX43 environmnent.

When compiling and linking a program i got the result that the linker (LD) I face the problem that LD cannot find the libraries needed.


The command line is as follows:

gcc xml1.cc -l/libgcc.a -l/libxalan-c1_3.a -l/libxerces-c1_6_0.a

Could someone help me with this?

Thanks
Chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Gcc Compile and link
       [not found] <616BE6A276E3714788D2AC35C40CD18D590DC9@whale.softwire.co.uk>
@ 2002-04-02  2:33 ` Rupert Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Rupert Wood @ 2002-04-02  2:33 UTC (permalink / raw)
  To: 'Simon, Christine'; +Cc: help-gcc

Chris Simon wrote:

> When compiling and linking a program i got the result that 
> the linker (LD) I face the problem that LD cannot find the 
> libraries needed.
:
> gcc xml1.cc -l/libgcc.a -l/libxalan-c1_3.a -l/libxerces-c1_6_0.a

If you're compiling C++, you should use the compiler driver 'g++'
instead - although this won't make any difference if there's no link
step.

If you want to link path/libSomething.a, you have two choices:

    g++ <...> path/libSomething.a
 or g++ <...> -L path -lSomething

The '-l' flag assumes prefix 'lib' and suffix '.a' (or prefers '.so'
where available unless you specify '-static' - I think!) and uses the
library search paths specified with '-L', from the LIB environment
variable or built in to gcc.

You shouldn't have to explicitly link libgcc; it should do that
automatically.

So, fingers crossed, the command line you want is:

    g++ xml1.cc -lxalan-c1_3 -lxerces-c1_6_0

which will generate output executable with the default name 'a.out'. To
specify another name, use the '-o' flag.

Hope that helps!
Rupert.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-02 10:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02  0:59 Gcc Compile and link Simon, Christine
     [not found] <616BE6A276E3714788D2AC35C40CD18D590DC9@whale.softwire.co.uk>
2002-04-02  2:33 ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).