Why do I get an error before "AT_NAME"?

I am kinda new at this.
I wanted to define a type based on an enum, which has all the directions a sprite can be facing in a game I am making. I defined the enum and typedef in the header for a display file. When I put it between the @interface and @end, I got a syntax error, but when I put it after the @end, I got an error in the .m file that I think has something to do with the #import. Where is the best place to put the typedef in my program: the .m file or the .h file, and where in the file? For now I used #define about 9 times, which is annoying.
I do not want to have to make a new header file for my program.

Hi thatonegeek, and welcome to the Dev Forum!
thatonegeek wrote:
I defined the enum and typedef in the header for a display file. When I put it between the @interface and @end, I got a syntax error ...
Yes. A typedef doesn't want to be part of a class interface.
but when I put it after the @end, I got an error in the .m file that I think has something to do with the #import.
An error in a .h file will only be reported in the .m files which #import that header. Without the message text it's hard to guess what the compiler doesn't like about the typedef. One possibility is that one of the @interface declarations uses that enum type. To rule out that case, try putting the typedef above the @interface, e.g. between any #imports and the @interface directive.
Otherwise it might help to drop your typedef above main() in a minimal C program to rule out any syntax error. A period that wants to be a comma can be hard to spot until the enum is isolated. An Obj-C compile might report a different error every time we move the typedef without ever letting us know the typedef syntax itself is wrong.
Where is the best place to put the typedef in my program: the .m file or the .h file.
Typedefs belong in .h files. But as discussed above, they need to be visible wherever the type is used since AFAIK there's no standard syntax for the forward declaration of an enum type (though I think that's supported as a C extension by some compilers). If you're using Xcode, one approach would be to make the typedef visible globally by putting it in your _Prefix.pch file.
If none of the above is helpful please post the .h file in question. In that case please copy and paste directly from the source file to the forum and use + Your code here + to format your post.
- Ray

Similar Messages

Maybe you are looking for

  • My iphone 5 is not showing up in itunes

    i am connecting my iphone 5 to the computer and is not recognizing it. i do have the latest version of itunes so i dont know what else to do.

  • Problem with digital signature of documents

    I have a requirement to upload documents and his respected fingerprint signed (SHA1WithRSA). To achive this I am using the functions modules: SSF_KRN_DIGEST SSF_KRN_SIGN_BY_AS but I can´t make it work. I also ask for the .pem file used to generate th

  • Possible bug in GDM with new user

    Hi, I created a user in the system settings app in gnome and I set the password to be set at first login, but now logging out of the current user and trying to login to the new user without the password on gdm I just get nothing where 'create new UNI

  • How can I tell the date I created a DVD?

    My wife has just asked me when I created a DVD for her. I stuck it in my iMac and selected "Get Info", both on the disc and later its contents but the only creation date was the present moment in time! How can I determine the time and date it was bur

  • Free dvd maker is better than encore cs4

    Hi Forum, OS: Win Vista Ultimate 64bit Encore CS4 Windows DVD Maker I have shot some footage and have they in dvd pal format. I was able to create a motion menu, slide show and advd with encore cs4. i could play the dvd on pcs and normal dvd player o