Programming Tips - gcc: Avoid /usr/bin/ld: skipping incompatible [lib] when searching for [lib]

Date: 2020oct25 Product: gcc Language: C/C++ Q. gcc: Avoid /usr/bin/ld: skipping incompatible [lib] when searching for [lib] For example:
/usr/bin/ld: skipping incompatible /usr/lib/libg.a when searching for -lg /usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
Q. This occurred to me when I was compiling a program on a 64-bit system that also had 32-bit libraries. The warning is just letting you know what its doing but still compiles and links. I corrected it by changing
LINKFLAGS = -L/usr/lib -lg -lstdc++ ;
to
LINKFLAGS = -L/usr/lib64 -lg -lstdc++ ;
(This is in a Jamfile - not a Makefile - but same idea)