0

I am lost .

i used to use the CCScrollLayer a lot, its a cocos2d class but now i got a strange error- mach-o-linker.

  1. i have added the classes to my project (CCScrollLayer.h+m)
  2. i have imported them
  3. i have defined : CCScrollLayer *scroller;

then , when i put this line of code :

   scroller = [[CCScrollLayer alloc] initWithLayers:[NSArray arrayWithObjects:page1,page2,nil] widthOffset:100];

i got mach-o-linker errors !!!

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_CCScrollLayer", referenced from:
      objc-class-ref in mainScene.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

i have defined armv6 and 7, at the project settings .

what is that ?? i know its not a code error but soemthing different.

Guru
  • 21,652
  • 10
  • 63
  • 102
user1280535
  • 347
  • 3
  • 13

4 Answers4

0

Probably you should add implementation file for CCScrollLayer to the CompileSources in BuildPhases of your target if it's not there yet

Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
0

Are they added to the right target? I'm not sure but I think a lot of mach-o-linker errors have the same solution.

Check this post out: Apple Mach-O Linker Error when compiling for device

Community
  • 1
  • 1
yoeriboven
  • 3,541
  • 3
  • 25
  • 40
0

Make sure that CCScrollLayer.m is listed in the compile sources stage of your project.

The error means, that a linker failed to find named class in all the objects it has got. Linker's task is to build a final executable with all inter-file links bound correctly, and if it cannot fulfil one of the links it fails.

The common reason to this is "forget" to add one of the compiled files as a source file for linker. As Xcode does that automatically based on all the compiled files -- you, most probably, forgot to add it as a compilable file at all.

Farcaller
  • 3,070
  • 1
  • 27
  • 42
  • i have draged the files to my project, and i have added the file to the compile-source at the build settings, when i added it in there, i get 2 more errors, and the previous errors stay there .. – user1280535 Sep 08 '12 at 13:22
0

Check to make sure you have CCScrollLayer in your compile sources. If it's not there, add it: Target > Build Phases > Compile Sources

canzhiye
  • 1,185
  • 1
  • 7
  • 5