There was a kid’s book I had, when I still was a kid, about a native American child. Her elders told her that to catch a fish, she had to think like a fish. Or maybe it was bear, or a mountain goat. I don’t actually remember. So Little Bobcat developed her analytical little wits and finally caught herself a fish.
There’s a lot I have yet to learn about the XCODE debugger. In fact, just about everything. I haven’t even figured out where to go to learn about how the debugger works. I’m still just looking at error messages and going from there. Tonight I had ‘duplicate symbol _main’. I clicked on every highlighted place I could find. I looked at the thread displaying the hierarchy of file names. I looked through each of the five files I’d created, but I only found the word ‘main’ in one place. * Finally I just decided to think like a fish.
Somewhere, I must have more than one of those lines that looks like this
int main(void) {
but I sure didn’t see it in any of my ‘.m’ or ‘.h’ files.
So I started opening up gates. That’s what a fish would do, right? A fish like XCODE looks at all the files in the project. (One heck of a smart fish) and that fish recognizes the name of the project. So the fact that I was expecting my fish to only respond to the lines (my fishing line that is) in a file called ‘main.m’, didn’t mean that she wasn’t going to look around for other files. Particularly a file with the same name as my project – ‘protocols.m’, a file created by default in a folder called ‘SOURCE’ when I created a new project. Sure enough, there was the culprit line. More than one ‘main’ makes trouble.
Cast your (main) lines upon the water, but only one at a time.
* After I resolved this error, it occurred to me that ‘find in project’ would have been another good way to scout out this problem.
No comments:
Post a Comment