NSLog错误:找不到'NXConstantString'?

Joh*_*ard 4 cocoa gcc objective-c nslog gnustep

我终于让GNUstep工作(在Windows上),它编译并运行良好.但是,每当我尝试使用NSLog时,都会收到以下错误:

$ 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'
Run Code Online (Sandbox Code Playgroud)

我的源代码:

#import <Foundation/Foundation.h>

int main(void) {
    NSLog(@"hello world");
}
Run Code Online (Sandbox Code Playgroud)

Mah*_*esh 11

它是 -

NSLog(@"hello world");
Run Code Online (Sandbox Code Playgroud)

 NSlog(@"hello world");  // 'l' should be upper case in NSLog
Run Code Online (Sandbox Code Playgroud)

试试这个 -

gcc -o hello hello.m -I /usr/lib/GNUstep/System/Library/Headers \
-L /usr/lib/GNUstep/System/Library/Libraries/ -lgnustep-base \
-fconstant-string-class=NSConstantString
Run Code Online (Sandbox Code Playgroud)

如何使用gcc编译目标c程序