-
-
Save tai2/453a5fa668e39c3b0a55b592216dd622 to your computer and use it in GitHub Desktop.
duplicate symbol test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int a = 1; | |
int main() { | |
printf("%d\n", a); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int a = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcc a.c b.c -o test | |
duplicate symbol _a in: | |
/var/folders/sp/s96yk_gj46jf2nwkgtmylmnw0000gn/T/a-28e783.o | |
/var/folders/sp/s96yk_gj46jf2nwkgtmylmnw0000gn/T/b-e8927c.o | |
ld: 1 duplicate symbol for architecture x86_64 | |
clang: error: linker command failed with exit code 1 (use -v to see invocation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment