SAM
SAM copied to clipboard
[Linux] Can't compile, multiple definition issue
Logs:
gcc -Wall -Os -c src/reciter.c
gcc -Wall -Os -c src/sam.c
gcc -Wall -Os -c src/render.c
gcc -Wall -Os -c src/main.c
src/main.c: In function ‘main’:
src/main.c:233:9: warning: ‘strncat’ specified bound 256 equals destination size [-Wstringop-overflow=]
233 | strncat(input, "[", 256);
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:237:12: warning: ‘strncat’ specified bound 256 equals destination size [-Wstringop-overflow=]
237 | } else strncat(input, "\x9b", 256);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -Wall -Os -c src/debug.c
gcc -o sam reciter.o sam.o render.o main.o debug.o
/usr/bin/ld: sam.o:(.bss+0x3e1): multiple definition of `X'; reciter.o:(.bss+0x1): first defined here
/usr/bin/ld: sam.o:(.bss+0x3e0): multiple definition of `Y'; reciter.o:(.bss+0x0): first defined here
/usr/bin/ld: sam.o:(.bss+0x3e2): multiple definition of `A'; reciter.o:(.bss+0x2): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: sam] Error 1
System info: EndeavourOS, Linux 5.14.0-rc5-1-mainline #1 SMP PREEMPT Mon, 09 Aug 2021 10:28:23 +0000 x86_64 GNU/Linux
gcc v11.1.0
ld v2.36.1
Fixed with #19 apparently
Alternatively, fixed with #14