我終於得到GNUstep的工作(在Windows),它編譯和運行良好。但是,每當我嘗試使用的NSLog,我得到以下錯誤:NSLog錯誤:找不到'NXConstantString'?
$ gcc -o hello hello.m -I /GNUstep/System/Library/Headers \
> -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base
hello.m: In function 'main':
hello.m:4:5: error: cannot find interface declaration for 'NXConstantString'
我的源代碼:
#import <Foundation/Foundation.h>
int main(void) {
NSLog(@"hello world");
}
:
-lgnustep-base-fconstant-class=NSConstantString
正道試驗,似乎我得到th每當我在我的字符串之前有一個@,而不僅僅是當我使用NSLog。 – 2011-02-12 04:37:50
這是我的整個代碼。 – 2011-02-12 04:39:30
在你的字符串之前沒有`@`會使它成爲一個普通的C字符串,這是'NSLog`格式字符串使用的錯誤類型。 – 2011-02-12 06:18:31