Lyricdev
GitHub

LYR-LNK0003

a C symbol two inputs of the link define

error · spec 15-project

Reported by build, run, test and bench when the linker finds a symbol defined twice — by two packages' C, a package and the program, or one package twice. The finding names who defines it and where. Nothing is linked; the exit code is 2.

Explanation

C has one namespace for the functions and variables a program links: two definitions of one name are one too many, wherever they come from. Two packages that each carry a copy of the same small C library, or of a helper named the same, meet here.

Rename one of them, make one static where only its own file calls it, or leave one package's copy out — a package that depends on another can use that one's C instead of its own.

Example

$ lyric5 build
error[LYR-LNK0003]: 'twice_c' is defined by app and by geo
  = note: defined at a.c:1 (app/native/a.c:1)
  = note: defined at b.c:1 (geo/native/b.c:1)
  = help: a C symbol is defined once in a program: rename one of them, make one 'static', or leave one of the packages out