{"id":1618,"date":"2024-04-16T20:13:39","date_gmt":"2024-04-16T12:13:39","guid":{"rendered":"https:\/\/wp.minicoda.com\/?p=1618"},"modified":"2024-04-24T08:01:11","modified_gmt":"2024-04-24T00:01:11","slug":"%e5%a6%82%e4%bd%95%e6%9e%84%e5%bb%baobjc%e8%af%ad%e8%a8%80%e7%bc%96%e8%af%91%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/wp.minicoda.com\/index.php\/%e5%a6%82%e4%bd%95%e6%9e%84%e5%bb%baobjc%e8%af%ad%e8%a8%80%e7%bc%96%e8%af%91%e7%8e%af%e5%a2%83\/","title":{"rendered":"\u5982\u4f55\u6784\u5efaObjC\u8bed\u8a00\u7f16\u8bd1\u73af\u5883?"},"content":{"rendered":"\n<p>  \u9664\u4e86\u5728\u7ebfObjC\u7f16\u8bd1\u5668\uff0c\u672c\u5730\u73af\u5883Windows\/Mac\/Linux\u5747\u53ef\u4ee5\u642d\u5efaObjC\u7f16\u8bd1\u73af\u5883\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Mac\u81ea\u7136\u4e0d\u7528\u591a\u8bf4\uff0cObjC\u662f\u4eb2\u513f\u5b50\u3002<\/li>\n\n\n\n<li>(WSL Ubuntu 22.04) Ubuntu\u53ef\u4ee5\u5b89\u88c5gobjc\/gnustep\u548cgnustep-devel\u6784\u5efa\u7f16\u8bd1\u73af\u5883\u3002<br>sudo apt-get install gobjc gnustep gnustep-devel<br><br>\u6ce8\u610fClang\u4e00\u6837\u53ef\u4ee5\u7f16\u8bd1ObjC\uff0c\u4f46Clang\u672c\u8eab\u4e0d\u5305\u542bObjC\u6700\u57fa\u672c\u7684\u5934\u6587\u4ef6\u548c\u5e93\uff0c\u9700\u8981\u5355\u72ec\u4e0b\u8f7d\uff0c\u9700\u4e0a\u9762\u7684\u5b89\u88c5\u547d\u4ee4\u5b8c\u6210\u6b64\u73af\u5883\u914d\u7f6e\u3002<br><br>  \u7f16\u8bd1\u65b9\u6cd51\uff1a\u53ef\u4ee5\u4f7f\u7528\u5b98\u65b9\u61d2\u4eba\u7248bash \/usr\/share\/GNUstep\/Makefiles\/GNUstep.sh\u5e76\u5199\u4e00\u4e2aobjc\u7f16\u8bd1<br>\u7684makefile\uff0c\u7528make\u547d\u4ee4\u641e\u5b9a\u3002<br>  \u7f16\u8bd1\u65b9\u6cd52\uff1a\u5229\u7528gnustep-config --objc-flags\u548cgnustep-config --objc-libs\u83b7\u53d6objc\u7f16\u8bd1\u9009\u9879\uff0c\u5e76\u5728\u7f16\u8bd1\u65f6\u5e26\u5165(\u6ce8\u610f\uff0c\u9700\u989d\u5916\u589e\u52a0-lgunstep-base)\u3002\u4f8b\u5982\uff1a<br>  gcc demo.m <strong><em>-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fconstant-string-class=NSConstantString -I. -I\/home\/cx\/GNUstep\/Library\/Headers -I\/usr\/local\/include\/GNUstep -I\/usr\/include\/GNUstep -shared-libgcc -pthread -fexceptions -rdynamic -L\/home\/cx\/GNUstep\/Library\/Libraries -L\/usr\/local\/lib -L\/usr\/lib -lobjc -lm -lgnustep-base<\/em><\/strong> -o demo<br><br>\u5982\u7528Clang\u7f16\u8bd1\uff0c\u4f1a\u9047\u5230\"objc\/objc.h file not found\"\u7684\u9519\u8bef\uff0c\u76f8\u6bd4\u4e0a\u9762\u7684GCC\u547d\u4ee4\uff0c\u9700\u8981\u591a\u52a0\u4e00\u4e2a\u5934\u6587\u4ef6\u8def\u5f84\u7684\u53c2\u6570\u53c2\u6570\uff1a-I\/usr\/lib\/gcc\/x86_64-linux-gnu\/11\/include\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u624b\u52a8\u6784\u9020\u8f6f\u94fe\u63a5sudo ln -s \/usr\/lib\/gcc\/x86_64-linux-gnu\/<strong><em>11<\/em><\/strong>\/include\/objc \/usr\/local\/include\/objc\u6765\u89e3\u51b3\u3002<br><\/li>\n\n\n\n<li>(Windows 10) Windows\u53ef\u4ee5\u4e0b\u8f7dgnustep\u53ef\u6267\u884c\u5305\uff0c\u548c\u4e0a\u9762Ubuntu\u7684gnustep\u7c7b\u4f3c\uff0c\u53ea\u4e0d\u8fc7\u662fWindows\u7248\u672c\uff0c\u81ea\u7136\u53ea\u652f\u6301ObjC 1.0\uff0c\u4e0d\u652f\u63012.0.<br><a rel=\"noreferrer noopener\" href=\"http:\/\/ftpmain.gnustep.org\/pub\/gnustep\/binaries\/windows\/\" target=\"_blank\">http:\/\/ftpmain.gnustep.org\/pub\/gnustep\/binaries\/windows\/<\/a><br>GNUSTEP developer guide\u53ef\u53c2\u8003\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/gnustep.github.io\/developers\/documentation.html\">GNUstep: Documentation<\/a>\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5df1\u7ec4\u88c5\u7f16\u8bd1\u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<br>  H:\\tools\\GNUstep\\bin\\gcc.exe demo.m -I H:\/tools\/GNUstep\/GNUstep\/System\/Library\/Headers -L H:\/tools\/GNUstep\/GNUstep\/System\/Library\/Libraries -std=c99 -lobjc -lgnustep-base -fconstant-string-class=NSConstantString<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u9664\u4e86\u5728\u7ebfObjC\u7f16\u8bd1\u5668\uff0c\u672c\u5730\u73af\u5883Windows\/Mac\/Linux\u5747\u53ef\u4ee5\u642d\u5efaObjC\u7f16\u8bd1\u73af\u5883\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[299],"tags":[],"class_list":["post-1618","post","type-post","status-publish","format-standard","hentry","category-think"],"views":70,"_links":{"self":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/1618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/comments?post=1618"}],"version-history":[{"count":6,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/1618\/revisions"}],"predecessor-version":[{"id":1841,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/1618\/revisions\/1841"}],"wp:attachment":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/media?parent=1618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/categories?post=1618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/tags?post=1618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}