Linker reports "multiple definition of ... first defined here"

Solution Unverified - Updated -

Issue

  • Linker reports "multiple definition of ... first defined here"
  • Cannot compile software, with error like:
/usr/bin/ld: file1.o:(.bss+0x0): multiple definition of `symbol_name'; file2.o:(.bss+0x0): first defined here
/usr/bin/ld: file2.o: in function `main':

Environment

  • Red Hat Enterprise Linux 9
  • GCC (GNU C Compiler) 11 and later
  • LD GNU Linker

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content