If you get a duplicate error in OpenCV

If you get an error like the one below, you should check to make sure that you are not declaring the same function as another file.

ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This time the error occurred because the declaration int main(int argc, const char * argv[]){ XXX } was declared in both main.m and main.c.
In this case, it looked like only main.c would be used, so I commented out this declaration in main.m to solve the problem.

In C, it seems that the compiler automatically reads other files as well.
The following sites are helpful.

http://d.hatena.ne.jp/hadashia/20121119/1353341718