-
-
Save tai2/17d0578d0a40ff1ee237952433cbf597 to your computer and use it in GitHub Desktop.
duplicate symbol test 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
#include <stdio.h> | |
#include "a.h" | |
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 = 1; |
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 "a.h" |
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-de1c69.o | |
/var/folders/sp/s96yk_gj46jf2nwkgtmylmnw0000gn/T/b-b26af6.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