I would be so grateful if someone could help me, I have been banging my head a 
against a brick wall for days on this now.
Here’s a sample project if it helps… 
http://www.thingsidoatwork.co.uk/MyProject.zip 
<http://www.thingsidoatwork.co.uk/MyProject.zip>

I'm creating a Framework wrapper round a static library. The header 
(MyLibrary.h) needs to be accessable from the ViewController.m file in MyProject

MyProject
        MyFramework
                        MyLibrary.h
                        libMyLibrary.a



#import "ViewController.h"
@import MyFramework;

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [[[MyLibrary alloc]init]test];
}


I have set MyLibrary.h to public
MyFramework.h contains the line #import <MyFramework/MyLibrary.h>
'Embedded Binaries' is set to MyFramework
When I run the above code I get...


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


The only way I have found to solve this problem is to create a private Class in 
MyFramework (called TestClass) and allocate MyLibrary. I assume this forces 
MyLibrary to be linked at runtime and accessable from ViewController.
But this is ugly as hell, what am I missing? 

#import "TestClass.h"
#import "MyLibrary.h"

@implementation TestClass
- (id)init {
    if (self = [super init]) {
        
        [MyLibrary alloc]; //solves the problem of MyLibrary being accessable 
from  ViewController
    }
    return self;
}
@end


Is there a compiler flag I’m missing that would help? I have tried all-load 
-ObjC etc but no luck.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to