Skip to content

Instantly share code, notes, and snippets.

@tai2
Created October 8, 2018 13:16
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/17d0578d0a40ff1ee237952433cbf597 to your computer and use it in GitHub Desktop.
Save tai2/17d0578d0a40ff1ee237952433cbf597 to your computer and use it in GitHub Desktop.
duplicate symbol test 2
#include <stdio.h>
#include "a.h"
int main() {
printf("%d\n", a);
}
int a = 1;
#include "a.h"
$ 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