I tried to place const double NA = 1e-300; in the header file for Cocoa-Touch but Xcode doesn’t like it. However when I did this in Cocoa(64 bit MAC), it works just fine.
????????
Errors:
Duplicate symbol _NA in
/Users/jdl/Library/Developer/Xcode/DerivedData/iExperiment-chcmotcyeolxeacnidtlgofkcihz/Build/Intermediates/iExperiment.build/Debug-iphonesimulator/iExperiment.build/Objects-normal/i386/ViewController.o
and
/Users/jdl/Library/Developer/Xcode/DerivedData/iExperiment-chcmotcyeolxeacnidtlgofkcihz/Build/Intermediates/iExperiment.build/Debug-iphonesimulator/iExperiment.build/Objects-normal/i386/AppDelegate.o
for architecture i386
Command
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang
failed with exit code 1
#import <UIKit/UIKit.h>
const double NA = 1e-300; // <------------- Error in Cocoa-Touch but not Cocoa ??
// So where do I put this so it doesn't error out in Cocoa-Touch??
@interface ViewController : UIViewController
{
UITextView *tvText;
}
@end
Constants defined in header files should look like this:
The
__unusedis to suppress compiler warnings for unused variables, and thestaticprevents the constant being exposed to the linker, which will solve your problem.