can you link to more than 1 library?

can you link to more than 1 library?

Post by (77k » Sun, 23 Aug 1998 04:00:00



lets say my lib dir consisted of
libx.a liby.a

can i just say g++ ...-L../lib/libx.a ...-L../lib/liby.a
?

 
 
 

can you link to more than 1 library?

Post by Jens Schweikhard » Sun, 23 Aug 1998 04:00:00


# lets say my lib dir consisted of
# libx.a liby.a

# can i just say g++ ...-L../lib/libx.a ...-L../lib/liby.a

No, but you're close. -L specifies a directory and -l specifies
a library without the lib and .a. So you have the choice among

        g++ ... -L../lib -lx -ly

or

        g++ ... ../lib/libx.a ../lib/liby.a

Note that .a files are recognized as libraries by their suffix.

Regards,

        Jens
--
Jens Schweikhardt  http://www.shuttle.de/schweikh
SIGSIG -- signature too long (core dumped)

 
 
 

can you link to more than 1 library?

Post by Lane Hal » Tue, 25 Aug 1998 04:00:00




> # lets say my lib dir consisted of
> # libx.a liby.a

> # can i just say g++ ...-L../lib/libx.a ...-L../lib/liby.a

I have never been able to get the -L option to work with more than 1
directory at a time.  
Quote:

> No, but you're close. -L specifies a directory and -l specifies
> a library without the lib and .a. So you have the choice among

>         g++ ... -L../lib -lx -ly

> or

>         g++ ... ../lib/libx.a ../lib/liby.a

> Note that .a files are recognized as libraries by their suffix.

> Regards,

>         Jens
> --
> Jens Schweikhardt  http://www.shuttle.de/schweikh
> SIGSIG -- signature too long (core dumped)

 
 
 

can you link to more than 1 library?

Post by Jens Schweikhard » Tue, 25 Aug 1998 04:00:00


#>
#> # lets say my lib dir consisted of
#> # libx.a liby.a
#>
#> # can i just say g++ ...-L../lib/libx.a ...-L../lib/liby.a

# I have never been able to get the -L option to work with more than 1
# directory at a time.  

Then your implementation is broken (if it's not a "pilot error" :-)
POSIX (aka ISO 9945-2) requires that the C compilation system
understand at least 10 (ten) -L operands simultaneously.
Or it does not claim POSIX conformance, which is hopefully rare these days.

#> No, but you're close. -L specifies a directory and -l specifies
#> a library without the lib and .a. So you have the choice among
#>
#>         g++ ... -L../lib -lx -ly
#>
#> or
#>
#>         g++ ... ../lib/libx.a ../lib/liby.a
#>
#> Note that .a files are recognized as libraries by their suffix.
#>
#> Regards,
#>
#>         Jens

Regards,

        Jens
--
Jens Schweikhardt  http://www.shuttle.de/schweikh
SIGSIG -- signature too long (core dumped)

 
 
 

can you link to more than 1 library?

Post by Brent Burkholde » Wed, 26 Aug 1998 04:00:00





> #>

> #> # lets say my lib dir consisted of
> #> # libx.a liby.a
> #>
> #> # can i just say g++ ...-L../lib/libx.a ...-L../lib/liby.a

> # I have never been able to get the -L option to work with more than 1
> # directory at a time.

> Then your implementation is broken (if it's not a "pilot error" :-)
> POSIX (aka ISO 9945-2) requires that the C compilation system
> understand at least 10 (ten) -L operands simultaneously.
> Or it does not claim POSIX conformance, which is hopefully rare these days.

He's just doing it wrong.  -L specifies a directory to find libs in,
-l specifies the lib name (ie. -lx would load libx.a found in a
directory specified by -L)  

Or, just shortcut all that and simply remove the -L, so that
you're directly specifying the object code to be rolled into your
executible (ie.  gcc /path1/libx.a /path2/important.o -o myprogram)

 
 
 

1. linking static library against another library

Hi,

I'm trying to link a static library against another static library, but I
get lot of 'undefined reference' errors.

here's what I have

/Common
        some cpp files resulting to libCommon.a

/Simulation
        some cpp files, which use classes from /Common, resulting to
        libSimulation.a
/
        main.cpp, using libSimulation.a

I want compile all the /Common stuff into a single static library,
libCommon.a. This will then get used by libraries for specific
applications, e.g. Simulation. I want the /Simulation stuff also to be
compiled into a library, which uses the libCommon.a

Both libraries compile and link, but when I try to link the main executable
it complains about undefined references in libSimulation.a

Some help please?

Morfeas

--
www.freecfm.com/m/morfeas

2. Java DK for sparc Netbsd? Netscape for Sparc Netbsd

3. Linking a .a library into a .so library

4. tcpdump for 4.0

5. dynamic link libraries and static libraries

6. How can I share a page between two process?

7. Question: Inclusion of shared libraries during linking of shared libraries

8. Complete Newbie needs help

9. Problem linking when using C++ library in a library on Solaris

10. libraries linking libraries

11. Problems linking static library on executable and static library

12. link static libraries into a shared library

13. It's not bad canned meat...