Can linking to the same library twice be a problem with g ++?

I noticed that when I make my application with gcc and look at the output during the bind phase, I see that the following lib is turned on twice:

/home/rb01/opt/trx-HEAD/gcc/4.2.4/lib/../lib64/libstd++. So

And so I'm just wondering if this is a problem with g ++ (gcc), or if the second is just ignored?

Thanks!

+4
source share
1 answer

If characters are already allowed in the library, the linker ignores them. In shared libraries, as in this case, the linker is not actually referenced.

With static (.a) libraries, several copies on the command line can be useful, if not very nice, if, for example, the main access to libb, which refers to libc, which refers to something in libb, does not get access via main:

ld main.o -lb -lc -lb 

- One way to eliminate all links.

+7
source

Source: https://habr.com/ru/post/1301597/


All Articles