Article 53K9F Multiple definition errors when linking on arch using gcc 10.1.0

Multiple definition errors when linking on arch using gcc 10.1.0

by
Andy Alt
from LinuxQuestions.org on (#53K9F)
Someone opened an issue reporting "multiple definition" errors when building on arch. I was able to reproduce the problem after updating an arch docker image locally (gcc 10.1.0 was the default after the update).

Here's part of the log:

Quote:
Making all in src
make[1]: Entering directory '/home/murali/Downloads/rmw/build/src'
make all-am
make[2]: Entering directory '/home/murali/Downloads/rmw/build/src'
CCLD rmw
/bin/ld: rmw-restore_rmw.o:/home/murali/Downloads/rmw/build/src/../../src/rmw.h:95: multiple definition of verbose'; rmw-main.o:/home/murali/Downloads/rmw/build/src/../../src/rmw.h:95: first defined here /bin/ld: rmw-config_rmw.o:/home/murali/Downloads/rmw/build/src/../../src/rmw.h:95: multiple definition of verbose'; rmw-main.o:/home/murali/Downloads/rmw/build/src/../../src/rmw.h:95: first defined here
I have this at the top of rmw.h, which in the past has prevented such problems:

Code:#ifndef _INC_RMW_H
#define _INC_RMW_HIt builds on other distros, and built on arch before I updated (which I hadn't done for over six months).

Here is a successful build log on Ubuntu Bionic that ran 27 days ago (no code changes since then).latest?d=yIl2AUoC8zA latest?i=upEyaWgmxTo:DME73mZnU8Y:F7zBnMy latest?i=upEyaWgmxTo:DME73mZnU8Y:V_sGLiP latest?d=qj6IDK7rITs latest?i=upEyaWgmxTo:DME73mZnU8Y:gIN9vFwupEyaWgmxTo
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments