{"id":138,"date":"2013-05-23T21:46:27","date_gmt":"2013-05-23T13:46:27","guid":{"rendered":"http:\/\/hmu023267.chinaw3.com\/wordpress\/?p=4"},"modified":"2013-05-23T21:46:27","modified_gmt":"2013-05-23T13:46:27","slug":"windows%e4%b8%8b%e6%90%ad%e5%bb%baobjective-c%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/www.sunyuping.com\/index.php\/2013\/05\/23\/windows%e4%b8%8b%e6%90%ad%e5%bb%baobjective-c%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83\/","title":{"rendered":"Windows\u4e0b\u642d\u5efaobjective C\u5f00\u53d1\u73af\u5883"},"content":{"rendered":"<p>\t\t\t\t\u6700\u8fd1\u6253\u7b97\u9488\u5bf9iPhone\u3001iPod touch\u548ciPad\u5f00\u53d1\u4e00\u4e9b\u5e94\u7528\uff0c\u6240\u4ee5\uff0c\u9700\u8981\u5f00\u59cb\u5b66\u4e60Objective C\uff08\u82f9\u679c\u63a8\u51fa\u7684\u7c7b\u4f3cC\u8bed\u8a00\u7684\u5f00\u53d1\u8bed\u8a00\uff09\u3002\u7531\u4e8e\u82f9\u679c\u7684\u81ea\u6211\u5c01\u95ed\u7684\u4ea7\u4e1a\u94fe\u53d1\u5c55\u6a21\u5f0f\uff08\u4ece\u82af\u7247\u3001\u673a\u5668\u3001\u5f00\u53d1\u8bed\u8a00\u3001\u7ec8\u7aef\u4ea7\u54c1\u3001\u670d\u52a1\uff09\u7684\u9650\u5236\uff0c\u8981\u60f3\u5f00\u53d1\u9488\u5bf9\u82f9\u679c iPhone\u7b49\u4ea7\u54c1\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5c31\u9700\u8981\u7528Mac\u673a\u5668\uff0c\u5728Xcode\u7684IDE\u4e0a\u4f7f\u7528Objective C\u8bed\u8a00\u5f00\u53d1\u3002Mac\u673a\u5668\u5c31\u4e0d\u7528\u8bf4\u4e86\uff0c\u90a3\u6bd4PC\u673a\u5668\u8981\u8d35\u4e0d\u5c11\uff08\u5f53\u7136\u6027\u4ef7\u6bd4\u8fd8\u662f\u5f88\u9ad8\u7684\uff09\uff0c\u6240\u4ee5\uff0c\u8981\u60f3\u5ec9\u4ef7\u65b9\u5f0f\u5b66\u4e60Objective C\u5c31\u5fc5\u987b\u8981\u5728Windows\u4e0a\u80fd\u642d\u5efa\u4e00\u4e2aObjective C\u5f00\u53d1\u73af\u5883\u3002\u597d\u4e86\uff0c\u4e0d\u8bf4\u5e9f\u8bdd\u4e86\u3002<\/p>\n<p>      \u5728Windows\u4e0b\u642d\u5efaObjective C\u5f00\u53d1\u73af\u5883\uff0c\u9700\u8981\u5230GNUstep\u5b98\u65b9\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\uff0c\u56db\u4e2a\u8f6f\u4ef6\u5305\uff1aGNUstep MSYS System\u3001GNUstep Core\u3001GNUstep Devel\u3001Cairo Backend\u3002\u5176\u4e2d\uff0c\u524d\u4e24\u4e2a\u8f6f\u4ef6\u5305\u662f\u5fc5\u987b\u8981\u5b89\u88c5\u7684\uff0c\u7b2c\u4e09\u4e2a\u8f6f\u4ef6\u5305\u662f\u5b89\u88c5\u4e00\u4e9b\u5f00\u53d1\u5de5\u5177\uff0c\u6bd4\u5982\uff1agcc\u3001g++\u7b49\uff0c\u6240\u4ee5\u5982\u679c\u662f\u5b66\u4e60Objective C\u7684\u8bdd\uff0c\u8fd9\u4e2a\u5305\u4e5f\u662f\u5fc5\u987b\u8981\u5b89\u88c5\uff0c\u7b2c\u56db\u4e2a\u8f6f\u4ef6\u5305\u662f\u5b89\u88c5glib\u7b49\u5e93\uff0c\u8fd9\u4e2a\u5305\u5b89\u88c5\u4e0d\u5b89\u88c5\u6839\u636e\u5177\u4f53\u60c5\u51b5\u800c\u5b9a\u3002<\/p>\n<p>     \u81f3\u4e8eGNUstep\u662f\u4ec0\u4e48\u4e1c\u897f\uff0c\u6709\u4ec0\u4e48\u7528\u5904\uff0c\u8fd9\u91cc\u505a\u4e2a\u7b80\u5355\u7684\u4ecb\u7ecd\uff1aGNUstep\u5c31\u662f\u63d0\u4f9b\u7c7b\u4f3cCocoa\uff08\u82f9\u679cOS\u7684\u5f00\u53d1\u6846\u67b6\uff09\u7684API\u548c\u5de5\u5177\uff0c\u76ee\u524d\u652f\u6301GNU\/Linux and GNU\/HURD, Solaris, NetBSD, OpenBSD, FreeBSD, Darwin\u548cWindows\uff0c\u514d\u8d39\u4f7f\u7528\u7684\u3002\u8fd9\u4e2a\u9879\u76ee\u4f7fObjective C\u80fd\u5728\u591a\u6570\u6d41\u884c\u5e73\u53f0\u4e0a\u5f00\u53d1\u548c\u8fd0\u884c\u3002\u6709\u5173\u8be6\u7ec6\u7684\u4ecb\u7ecd\u5f00\u59cb\u53c2\u8003GNUstep\u7684\u5b98\u65b9\u7f51\u7ad9\u3002<\/p>\n<p>    \u8a00\u5f52\u6b63\u4f20\uff0c\u4e0b\u8f7d\u4e0a\u8ff0\u8f6f\u4ef6\u5305\u540e\uff0c\u70b9\u51fb\u5b89\u88c5\u5c31\u53ef\u4ee5\u4e86\u3002\u7136\u540e\uff0c\u9700\u8981\u786e\u8ba4\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u5e76\u4e14\u662f\u5426\u80fd\u6210\u529f\u7f16\u8bd1Objective C\u4ee3\u7801\u3002<\/p>\n<p>    \u5728\u201c\u5f00\u59cb\u201d\u83dc\u5355\u4e2d\u201c\u6240\u6709\u7a0b\u5e8f\u201d\u4e0b\u53ef\u4ee5\u627e\u5230\u201cGNUstep\u201d -> \u201cshell\u201d\uff0c\u5c31\u4f1a\u51faconsole\u7a97\u53e3\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u4e00\u4e9bLinux\u547d\u4ee4\uff08ls,cd,mkdir\u7b49\uff09\u3002<\/p>\n<p>\u7f16\u5199\u4e00\u4e2aObjective C\u4ee3\u7801\u8fdb\u884c\u7f16\u8bd1\u8fd0\u884c\u6d4b\u8bd5\u3002\u5728\u8fd9\u91cc\u5c31\u7528\u7ecf\u5178\u7684\u201chello world\u201d\u6765\u8bf4\u660e\uff1a<br \/>\n#import <foundation \/Foundation.h><br \/>\nint main (int argc, const char *argv[]) {<br \/>\n    NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];<br \/>\n    NSLog(@&#8221;Hello World!&#8221;);<br \/>\n    [pool drain];<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>    \u5728Windows\u73af\u5883\u4e0b\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08Editplus\uff0cUE\u7b49\uff09\uff0c\u7f16\u5199\u4e0a\u8ff0\u4ee3\u7801\uff0c\u5e76\u4e14\u4fdd\u5b58\u5230GNUstep\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684\/home\u4e0b\uff0c\u53d6\u540d\u4e3ahelloworld.m\u3002\u5728GNUstep\u7684console\u7a97\u53e3\u547d\u4ee4\u884c\u4e0b\uff0c<\/p>\n<p>    1\u3001cd \/home<\/p>\n<p>    2\u3001gcc -o helloworld helloworld.m -I\/GNUstep\/System\/Library\/Headers -fconstant-string-class=NSConstantString -L\/GNUstep\/System\/Library\/Libraries -lobjc -lgnustep-base<\/p>\n<p>    3\u3001\u8fd0\u884chelloworld.exe<\/p>\n<p>\u8bf4\u660e\uff1a\u7b2c\u4e8c\u6b65\u4e2d\u7684\u4e00\u4e9b\u53c2 \u6570\u660e\u8bf4\uff0c\u5982\u679c\u719f\u6089Linux\/Unix\u4e0bC\/C++\u7f16\u8bd1\u7684\u8bdd\uff0c\u4e0a\u8ff0\u53c2\u6570\u5e94\u8be5\u5f88\u719f\u6089\uff0c-I\u8868\u793a\u5934\u6587\u4ef6\u67e5\u627e\u7684\u8def\u5f84\uff0c-L\u8868\u793a\u5e93\u6587\u4ef6\u67e5\u627e\u8def\u5f84\uff0c-l\u8868\u793a\u9700\u8981\u94fe\u63a5 \u7684\u5e93\u6587\u4ef6\u3002\u4f46\u662f\uff0c-fconstant-string-class=NSConstantString  \u5bf9\u4e8e\u8fd9\u4e2a\u53c2\u6570\u53ef\u80fd\u6bd4\u8f83\u964c\u751f\uff0c\u8fd9\u4e2a\u53c2\u6570\u4e3b\u8981\u662f\u6307\u5b9a\u5e38\u91cf\u5b57\u7b26\u4e32\u6240\u4f7f\u7528\u7684class\u3002  <\/p>\n<p>\u6539\u8fdb\uff1a\u7531\u4e8e\u5728GNUstep\u7684\u7a97\u53e3\u4e0b\u4e0d\u80fd\u590d\u5236\uff0c\u7c98\u8d34\uff0c\u624b\u52a8\u6253\u5b57\u5bb9\u6613\u51fa\u9519\uff0c\u6240\u4ee5\uff0c\u53ef\u4ee5\u5199\u4e2ashell\u811a\u672c\uff0c\u53d6\u540d\u4e3atest.sh,\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<p>gcc -o &#8220;$1&#8221; &#8220;$2&#8221; -I\/GNUstep\/System\/Library\/Headers -fconstant-string-class=NSConstantString -L\/GNUstep\/System\/Library\/Libraries -lobjc -lgnustep-base<\/p>\n<p>\u7136\u540e\u548c\u4e0a\u9762\u7684\u4e00\u6837\uff0c\u5728GNUstep\u7684console\u7a97\u53e3\u547d\u4ee4\u884c\u4e0b  <\/p>\n<p>    1\u3001cd \/home<\/p>\n<p>    2\u3001sh test.sh  helloworld  helloworld.m<\/p>\n<p>    3\u3001\u8fd0\u884chelloworld.exe<\/p>\n<p>\u8bf4\u660e\uff1atest.sh\u4e2d\u7684$1 \u548c $2\u5206\u522b\u8868\u793a\u83b7\u53d6\u6267\u884ctest.sh\u65f6\u4f20\u8fdb\u6765\u7684\u7b2c1\u4e2a\u548c\u7b2c2\u4e2a\u53c2\u6570\uff0c\u7136\u540e\u901a\u8fc7sh test.sh  helloworld helloworld.m\u5c31\u662f\u6267\u884ctest.sh\u811a\u672c\u5e76\u4f20\u5165\u4e24\u4e2a\u53c2\u6570\uff0c\u91c7\u7528\u4f20\u53c2\u6570\u7684\u76ee\u7684\u662f\u8ba9\u8fd9\u4e2atest.sh\u6210\u4e3a\u4e00\u4e2a\u7f16\u8bd1\u7684\u6a21\u677f\uff0c\u8fd9\u6837\u6bcf\u6b21\u53ea\u8981\u4f20\u4e0d\u540c\u7684\u53c2\u6570\u5c31\u53ef\u4ee5\u7f16\u8bd1\u8fd0\u884c\u3002<\/p>\n<p>    helloworld.exe\u7f16\u8bd1\u5e76\u8fd0\u884c\u6210\u529f\u7684\u8bdd\uff0c\u8bf4\u660ewindows\u4e0bObjective C\u5f00\u53d1\u73af\u5883\u5c31\u642d\u5efa\u597d\u4e86\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5f00\u59cb\u4ee5\u5ec9\u4ef7\u65b9\u5f0f\u7684\u5b66\u4e60Objective C<\/foundation>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u6253\u7b97\u9488\u5bf9iPhone\u3001iPod touch\u548ciPad\u5f00\u53d1\u4e00\u4e9b\u5e94\u7528\uff0c\u6240\u4ee5\uff0c\u9700\u8981\u5f00\u59cb\u5b66\u4e60Objective C &#8230; <a title=\"Windows\u4e0b\u642d\u5efaobjective C\u5f00\u53d1\u73af\u5883\" class=\"read-more\" href=\"https:\/\/www.sunyuping.com\/index.php\/2013\/05\/23\/windows%e4%b8%8b%e6%90%ad%e5%bb%baobjective-c%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83\/\" aria-label=\"\u9605\u8bfb Windows\u4e0b\u642d\u5efaobjective C\u5f00\u53d1\u73af\u5883\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-138","post","type-post","status-publish","format-standard","hentry","category-2"],"_links":{"self":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/comments?post=138"}],"version-history":[{"count":0,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/posts\/138\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/media?parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/categories?post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sunyuping.com\/index.php\/wp-json\/wp\/v2\/tags?post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}