ld: 1 duplicate symbol for architecture x86_64
When you create a new project in Xcode, it automatically gives you a starting file with main()
in it. If you created a new file, such as first.c
, and then pasted your test code into it, you'll be defining main()
twice, and getting that error.
You need to either delete the file (such as main.c
, or main.m
) that Xcode provides in your new project, or cut and paste your sample code into that file, instead of creating a new one.