错误“Foundation.h:找不到这样的文件”在 WINDOWS 上编译 Objective-C 时
iam 是 Objective-C 的初学者,我尝试编译小型 Hello world 程序来启动,iam 使用 windows vista 和 shell 控制台,我的代码是:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
shell 结果显示以下错误:
Foundation.h: no such file found
我的编译命令是:
gcc -o hello hello.m
i will 感谢任何帮助,提前感谢:)
iam beginner in Objective-C, i tried to compile small Hello world program to start,iam using windows vista and the shell console, my code is:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
the shell result show me the following error:
Foundation.h: no such file found
my command for compiling is:
gcc -o hello hello.m
i will appreciate any help, thanx in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Foundation 以及 NSAutoreleasePool 和 NSLog 是 cocoa 和 cocoa-touch 的一部分,这是 Apple 独有的 ObjC 框架。虽然您可以使用 Objective-C、Foundation 以及所有 Foundation 类和函数仅在 Mac OS X 和 iOS 上可用。
如果您想继续使用 ObjC 和类,您有三种选择
尝试将 Foundation
Foundation, as well as NSAutoreleasePool and NSLog are part of cocoa and cocoa-touch, Apples exclusive ObjC Frameworks. While you can use Objective-C, Foundation and all Foundation classes and functions are only available on Mac OS X and iOS.
You have three choices if you want to continue working with ObjC und the classes
tries to clone Foundation
尝试将其写入您的命令行。我遇到了同样的问题,它对我有用。
Try writing this to your command line. I had the same problem and it worked for me.