Reputation: 1108
From what I understand, a linker error due to a duplicate symbol means that:
While trying to compile a demo project from www.ugfx.io I came across this error:
duplicate symbol _main in:
.build/obj/GFXLIB/demos/modules/gdisp/basics/main.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [.build/demotest.elf] Error 1
In contrast to every duplicate symbol error I could find on the web there is just one file listed as part of this error. And the source file belonging to this object file has just one main symbol. You can view it here.
How shall I even understand this error? And what could be its cause?
Upvotes: 1
Views: 2809
Reputation: 85
It happened to me when I included the same source file twice in the compiling command, e.g. :
$gcc -o main main.c becool.c foo.c bar.c becool.c end.c
The repeated becool.c
caused a duplicate symbol error.
So, if this is the problem, just review your compiling command and remove such duplicates
Upvotes: 2