我嘗試打開一個URL對象C我的代碼如下簡單的Objective-C的腳本打開一個URL
#include <stdio.h>
int main()
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.ithinksw.com/"]];
return 0;
}
,但是當我嘗試編譯它,我得到這些錯誤
hello.c: In function 'main':
hello.c:4: error: expected expression before '[' token
hello.c:4: error: 'NSWorkspace' undeclared (first use in this function)
hello.c:4: error: (Each undeclared identifier is reported only once
hello.c:4: error: for each function it appears in.)
hello.c:4: error: expected ']' before 'openURL'
hello.c:4: error: stray '@' in program
IM極值新本所以任何幫助將是巨大的:)
所以這樣? #include #import #include #link 是的他的iPhone版:P –
2011-12-30 12:43:11
是的,那是包括。另外,您必須將Foundation框架添加到您的項目中。 – 4ndrew 2011-12-30 12:49:53
有沒有辦法做到這一點,沒有Xcode是在那裏:( – 2011-12-30 12:55:05