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)
| 归档时间: |
|
| 查看次数: |
4159 次 |
| 最近记录: |