Question

I just started working with xCode and Objective C.

I created a project with an storyboard and implemented my entire program into the view-Controller. I wanted to put some of this code now into a different m-file wich I simply include and call methods from my new m-file in the view controller.

My problem is that I get not linker-errors every time I try to build it.

The error code is

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

What could cause this?

Was it helpful?

Solution

This error is due to you have a duplicate symbol somewhere. Check this link this will helpful for you

http://iphonedevsdk.com/forum/iphone-sdk-development/115858-apple-mach-o-linker-error.html

OTHER TIPS

You can't have multiple .m files for one .h file. You need to either:

  1. Keep all the code in the original .m file.
  2. Create a new class with it's own .h file.
  3. Create a category for the original class. (https://developer.apple.com/library/mac/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html)

Make sure you only have one @interface and one @implementation declaration for each class.

I found my problem.

I happened to implement the same variable as global in two m-files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top