6

I have added the Apple Reachability files to my project and I am already getting errors. I have NOT even added these files to any of my classes, only added them to my project. How could I already be getting this error?

When compiling I get the following error:

ld: duplicate symbol _OBJC_IVAR_$_Reachability.localWiFiRef in /Users/webmaster/Dropbox/iPhone-Development/Official-Projects/PUC/build/PUC.build/Debug-iphonesimulator/PUC.build/Objects-normal/i386/Reachability-B40F6D608A62C635.o and /Users/webmaster/Dropbox/iPhone-Development/Official-Projects/PUC/build/PUC.build/Debug-iphonesimulator/PUC.build/Objects-normal/i386/Reachability-823B59DA9A9B0D23.o
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

Note: I am using the Three20 project, so I am not sure if it could be conflicting somehow?

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412

2 Answers2

8

So, I figured it out. I realized that since I am using ShareKit, it also includes Reachability, so it WAS in my project twice, I just didn't realize it.

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
0

You need to #import your custom class's .h in your .m. Otherwise the #import "Reachability.h" is happening twice and, I'm guessing, there is a variable called localWiFiRef defined in Reachability.h that now is beind declared twice and hence the "duplicated symbol" error.

When doing that, you will not need to #import "Reachability.h" in the .m.

fsaint
  • 8,759
  • 3
  • 36
  • 48