How to make a Global Array?

Posted by Wayfarer on Stack Overflow See other posts from Stack Overflow or by Wayfarer
Published on 2010-03-19T23:42:05Z Indexed on 2010/03/19 23:51 UTC
Read the original article Hit count: 376

So, I read this post, and it's pretty much exactly what I was looking for. However... it doesn't work. I guess I'm not going to go with the singleton object, but rather making the array in either a Global.h file, or insert it into the _Prefix file.

Both times I do that though, I get the error:

Expected specifier-qualifier-list before 'static'

and it doesn't work. So... I'm not sure how to get it to work, I can remove extern and it works, but I feel like I need that to make it a constant.

The end goal is to have this Mutable Array be accessible from any object or any file in my project. Help would be appreciated!

This is the code for my Globals.h file:

#import <Foundation/Foundation.h>


@interface Globals : NSObject {
    static extern NSMutableArray * myGlobalArray;
}


@end

I don't think I need anything in the implementation file. If I were to put that in the prefix file, the error was the same.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsmutablearray