首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >NSLog错误:找不到'NXConstantString'?

NSLog错误:找不到'NXConstantString'?
EN

Stack Overflow用户
提问于 2011-02-12 12:35:12
回答 2查看 4.4K关注 0票数 5

我终于让GNUstep (在windows上)工作了,它可以编译并运行得很好。但是,每当我尝试使用NSLog时,我都会得到以下错误:

代码语言:javascript
复制
$ 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'

我的源码:

代码语言:javascript
复制
#import <Foundation/Foundation.h>

int main(void) {
    NSLog(@"hello world");
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-02-12 12:36:53

它是-

代码语言:javascript
复制
NSLog(@"hello world");

代码语言:javascript
复制
 NSlog(@"hello world");  // 'l' should be upper case in NSLog

试试这个-

代码语言:javascript
复制
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

How to compile objective c programs using gcc

票数 12
EN

Stack Overflow用户

发布于 2012-10-10 00:35:22

这很简单,只需在-lgnustep-base-fconstant-class=NSConstantString之间加一个空格

错误的方式:-lgnustep-base-fconstant-class=NSConstantString

正确的方法:-lgnustep-base -fconstant-class=NSConstantString

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4976351

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档