Reputation: 11
Alright, I'm trying to call a function in xcode but apparently it isn't working. I made an objective-c class, and typed in the following code into the implementation file:
#import "Person.h"
@implementation Person
void printthis()
{
NSLog(@"Hi, I have been printed");
}
int main(int argc, const char * argv[])
{
@autoreleasepool {
printthis();
}
return 0;
}
@end
Apparently, it returns the following error in xcode:
ld: 1 duplicate symbol for architecture x86_64
clang: error:
linker command failed with exit code 1 (use -v to see invocation)
Upvotes: 0
Views: 69
Reputation: 41123
Did you already have a main function somewhere else (probably main.m ?). If so the linker got confused -- you are not supposed to have duplicates of main function
Upvotes: 2