title: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_GlobalVariables", referenced from: objc-class-ref in MapViewController.o
body: <p>I am trying to create a Singleton so I can use a variable globally but I get this error:</p>
  
  <blockquote>
    <p>Undefined symbols for architecture arm64:<br>
    "_OBJC_CLASS_$_GlobalVariables", referenced from:
          objc-class-ref in MapViewController.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit
    code 1 (use -v to see invocation)</p>
  </blockquote>
  
  <p>Some solutions to this problem suggest adding a third-party library in build phases, but I don't know which library to add. Here is my Singleton class:</p>
  
  <p>.h </p>
  
  <pre><code>@interface GlobalVariables : NSObject
  
  @property BOOL *MAP_SATELLITE_VIEW;
  
  + (GlobalVariables*)sharedInstance;
  
  @end
  </code></pre>
  
  <p>.m</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  #import "GlobalVariables.h"
  
  
  @implementation GlobalVariables
  
  @synthesize MAP_SATELLITE_VIEW;
  
  #pragma mark Singleton Methods
  
  + (GlobalVariables*)sharedInstance {
      static GlobalVariables *obj = nil;
      static dispatch_once_t onceToken;
      dispatch_once(&amp;onceToken, ^{
          obj = [[self alloc] init];
          [obj loadVariables];
      });
      return obj;
  }
  
  - (void)loadVariables {
  
          self.MAP_SATELLITE_VIEW = NO;
  }
  
  @end
  </code></pre>
  
  <p>This is how I am trying to access the MAP_SATELLITE_VIEW variable from MapViewController:</p>
  
  <pre><code> [GlobalVariables sharedInstance].MAP_SATELLITE_VIEW
  </code></pre>