Skip to content

Instantly share code, notes, and snippets.

@tai2
Created October 8, 2018 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tai2/453a5fa668e39c3b0a55b592216dd622 to your computer and use it in GitHub Desktop.
Save tai2/453a5fa668e39c3b0a55b592216dd622 to your computer and use it in GitHub Desktop.
duplicate symbol test
#include <stdio.h>
int a = 1;
int main() {
printf("%d\n", a);
}
int a = 2;
$ 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