views:

59

answers:

2

Hi i've been struggling with these errors for a day now.

I'm using the TouchJSON framework(http://code.google.com/p/touchcode/) for the iphone.Everything compiles fine on the iphone simulator but when i try to compile on the device i get link errors.

Undefined symbols:

"___switch8", referenced from:
  -[NetworkController constructByteMessage:command:] in NetworkController.o
  -[CJSONScanner scanJSONObject:error:] in CJSONScanner.o

"___restore_vfp_d8_d15_regs", referenced from:
  +[CJSONDataSerializer initialize] in CJSONDataSerializer.o

"___save_vfp_d8_d15_regs", referenced from:
  +[CJSONDataSerializer initialize] in CJSONDataSerializer.o

"___switchu8", referenced from:
  -[CJSONScanner scanJSONStringConstant:error:] in CJSONScanner.o

ld: symbol(s) not found
collect2: ld returned 1 exit status

NetworkController is a class of mine which uses the touchJSON methods to parse and generate JSON. I think it's the touchJSON library that's causing most of the linking errors so i tried another framework json framework but it still causes 1 error.

I tried changing from "debug" to "release" but still gives the same errors. I then tried adding -all_load and -ObjC to the linker flags but it still errors. Any help or hints would be appreciated.

+1  A: 

You can try to use json-framework instead of touchJSON if you don't manage to fix the linker errors.

Serge
I tried to use the json-framework it gave me one error that was similar. "___switch32", referenced from:-[SBJsonParser scanRestOfString:] in SBJsonParser.o
A: 

This looks like some nice little bug with the switch statement, which is apparently a function / macro / whatever in Objective-C, at least now in iOS4. This is all very confusing. Does adding -lobjc to the linker flags help?

Serge
I tried adding -lobjc to "other linker flags" for the project and also the the target and it still errors.Thanks alot for the help so far.
I found out if i switch the compiler to llvm gcc 4.2 then it builds successfully. I'd like for it to build for gcc 4.2 succesfully although.