25

I have an error at compile time. Seems to be weird. it worked as detail view application, but using single view doesn't seem to work. this is the error details:

   Undefined symbols for architecture i386:
    "_OBJC_CLASS_$_RssArticle", referenced from:
      objc-class-ref in RssXmlParser.o
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
kenorb
  • 155,785
  • 88
  • 678
  • 743
Siddharthan Asokan
  • 4,321
  • 11
  • 44
  • 80

11 Answers11

57

Try these steps:

  1. Open your project in XCode.

  2. In left side window/panel of XCode click on your project name on top.

  3. Now select Target from right side panel of XCode.

  4. Select Build Phases from right panel's top. (here other option will be Build Settings, Build Rules)

  5. In the same panel open the "Compile sources", here check: are all the files (.m) listed? if not all files click on (+) sign in bottom to add (.m) files which is not in list

  6. As per your error it seems RssXmlParser not there, add this and compile again

It will work fine now.

kenorb
  • 155,785
  • 88
  • 678
  • 743
iOS Test
  • 1,103
  • 1
  • 11
  • 18
  • What version of X-Code does this work for? I can't seem to find Target on the right side... – Cameron Tarbell Feb 22 '14 at 02:48
  • @iOSTest I ran into the same issue. I want to know why does this happen, though. – Glide Apr 13 '14 at 06:06
  • Also check what you exactly subclassing your class! – Resty May 14 '14 at 06:38
  • for me in Xcode 8.3.3, Under Build Phases > Compile Sources i had some extra .m files that were not associated with the project i was working on and just removed them to solve the `linker command failed with exit code 1` error – nommer Jul 17 '17 at 17:36
27

don't see anybody suggesting to go to terminal and go to the directory where the project is and run

xcodebuild -verbose

to see detailed error and just reading the error helps a lot of the time

vp_gold
  • 532
  • 4
  • 12
  • this is not exactly an answer but still this+selected answer helped me solve my issue! Personally, I had two plugins .m files (served the same purpose) in the list of .m files. I removed one and built it again and that solved the problem. – Anjil Dhamala Jul 05 '17 at 20:25
13

I realized I had to use the .xcworkspace file instead of the .xcodeproj file.

netwire
  • 7,108
  • 12
  • 52
  • 86
7

Product -> Clean then Product -> Run :)

Oscar Falmer
  • 1,771
  • 1
  • 24
  • 38
2

In my case, I mistakenly created a new subclass of UIView with .h and .c files instead of .h and .m files. Changing the extensions was easy, but I didn't think to change the contents of the .m files. So my .h files had

#ifndef My_Project_MPMyView_h
#define My_Project_MPMyView_h

#import <UIKit/UIKit.h>

@interface MPMyView : UIView

@end

#endif

and my .m files incorrectly had

#include <stdio.h>

When I changed my .m files to

@interface MPMyView : UIView

@end

@implementation MPMyView

@end

The linker error was fixed.

Kevin
  • 14,655
  • 24
  • 74
  • 124
0

I solved the same issue because I created components as separate projects. After adding the folders to the main project, I forgot to delete the .plist, .string and extra main.m files from the imported component group directories.

Deleting these solved my issue because the app was obviously getting conflicting build commands...

0

I encountered this error due to duplicate filenames (I had created NSManagedObjectContext subclasses automatically in core data through the editor menu).

As of XCODE 5.0, just quit and restart and xcode should recognize this and fix it for you if you click on the yellow warning in the left hand pane

DanWebster
  • 141
  • 1
  • 5
0

A similar error just happened to me on Xcode 6.4. Seems like an Xcode bug.

My fix was to go to the ".o" file that caused the error, uncheck and recheck target memberships that you need.

haitham
  • 3,398
  • 6
  • 21
  • 35
0

I think it might be that you are trying to create two different .C file (with main function) in one project. C only allows you to have one main entrance every project.

0

I don't know how it worked.But i simply closed the xcode and open again by clicking xcworkspace file and worked for me. you may try hopefully this can solve your problem thank you.

yubaraj poudel
  • 3,821
  • 1
  • 31
  • 28
0

Hold down alt . On the top toolbar go to

Product > clean build folder

Press "clean build folder" and wait for it to build and run. It should resolve any errors in the build file.

Daniel
  • 2,028
  • 20
  • 18