|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
No storage class may be specified (Objective-c ) error
Hi,
I have been trying to figure out this error for the past 3 days. Simply don't understand what's wrong. I get this error with my Utilities.h class: Code:
error: no type or storage class may be specified here before 'interface' Here's the .h file for Utilities: Code:
#import <Foundation/Foundation.h>
@interface Utilities : NSObject {
}
+ (NSString *)getDocumentsDirectory;
+ (void)showActivityIndicator;
+ (void)hideActivityIndicator;
+ (void)setUser:(NSString *)userName withPassword:(NSString *)password;
+ (NSString *)getUserName;
+ (NSString *)getPassword;
+ (long long)generateTicketNumber;
+ (BOOL)reachable;
+ (NSString *)printerAddress;
+ (NSInteger)port;
+ (void)setAddress:(NSString*)newAddress andPort:(NSInteger)newPort;
+ (void)showDataActivity;
@end
Code:
#import "Utilities.h" @implementation Utilities @end Thanks. Last edited by Avicenna; Jul 6, 2011 at 04:11 PM. |
|
|
|
0
|
|
|
#2 |
|
Don't post links to the same question elsewhere. Either ask it here or don't ask. Post the entire code (not a screenshot, copy and paste) for your .h file.
__________________
Sponsor me to cycle 100Km round London in the dark |
|
|
|
0
|
|
|
#3 |
|
|
0
|
|
|
#4 |
|
I have tried creating a new Command Line Foundation tool and added your Utilities to it via copy and paste. I get no such error. I suspect you have a non-printable character that has meaning or something similar. Try moving Utilities.h to a new file name and creating a new file via copy and pasting the .h you posted to this site.
__________________
Sponsor me to cycle 100Km round London in the dark |
|
|
|
0
|
|
|
#5 |
|
When I copy and paste your provided source into suitable files and compile here, they compile with no errors, only the warnings about incomplete implementation of class 'Utilities'. Therefore, I suspect nothing is syntactically wrong with the posted source code.
I suspect there may be some invisible characters in your actual source file. Or perhaps you have damaged something in Foundation/Foundation.h. Or perhaps you have some unexpected search-path for #includes that is including the wrong Foundation.h. If there are invisible characters in your actual file, we won't be able to see them simply by you pasting code into posts. You'll have to compress and upload the actual files. Or you could use a hex editor such as Hex Fiend (google it) to inspect your source files for unexpected characters. Depending on which Xcode version you're using (3.x would be suitable, 4.x I don't know), you can choose Build > Preprocess and inspect the result to see if there's something unexpected after the expanded #import of Foundation.h, directly before your @interface. EDIT Another thing occurred to me: you might have an unexpected macro expansion appearing before your @interface, triggered by what you think is an innocuous word or term, but which the preprocessor is expanding into something that doesn't compile correctly. It's slightly odd that you're getting a specific "type or storage class" error. If there were uninterpretable invisible characters, I might expect a complaint about an unexpected character. But if the preprocessor is doing a macro substitution, and that leads to a syntax error, then the actual error isn't at the @interface, but at some location before it. If the actual source is exactly as posted, then that can only be at the end of the expanded #import of Foundation.h. However, if there is actually some other text between the #import and the @interface, then that could be causing the error and you've simply not bothered to post it because you believed it to be harmless. Last edited by chown33; Jul 6, 2011 at 04:48 PM. |
|
|
|
0
|
|
|
#6 |
|
Just in case anyone is ever interested, the XCode 4 equivalent is Product > Generate Output > Generate Preprocessed File
|
|
|
|
0
|
|
|
#7 |
|
On what version of Xcode 4 is there a Product > Generate Output > Generate Preprocessed File menu item? I'm using 4.0.2 and I don't see that.
|
|
|
|
0
|
|
|
#8 |
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Previous purchases may be unavailable if they are no longer in the iTunes Store | wd89 | Mac Applications and Mac App Store | 1 | Jun 6, 2011 08:13 PM |
| PS3 Launch May Be Delayed, Cost May Skyrocket - Thread #2 | Haoshiro | Games | 53 | Mar 1, 2006 10:46 AM |
| PS3 Launch May Be Delayed, Cost May Skyrocket | clayj | Games | 112 | Feb 27, 2006 10:18 AM |
| Problems surfing the internet - may be related to ethernet card (or not!) | thomasp | Macintosh Computers | 0 | Feb 26, 2005 11:58 AM |
All times are GMT -5. The time now is 07:41 PM.







Linear Mode

