0%

ld 选项 -warn-common

-warn-common 选项分析

编译警告

libtest.a(rmdec.c.o): warning: definition of `sipr_subpk_size' overriding common
libtest.a(matroskadec.c.o): warning: common is here
libtest.a(rdt.c.o): warning: common of `sipr_subpk_size' overridden by definition
libtest.a(rmdec.c.o): warning: defined here

原因

代码编写存在风险

  • 修改源码,去除编译警告
  • 去除 -warn-common 不生成编译警告

Ld Command Line Options

Warn when a common symbol is combined with another common symbol or with a symbol definition. Unix linkers allow this somewhat sloppy practice, but linkers on some other operating systems do not. This option allows you to find potential problems from combining global symbols. Unfortunately, some C libraries use this practice, so you may get some warnings about symbols in the libraries as well as in your programs. There are three kinds of global symbols, illustrated here by C examples: