{"id":300111,"date":"2024-05-20T17:34:33","date_gmt":"2024-05-20T09:34:33","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/300111.html"},"modified":"2024-05-20T17:34:49","modified_gmt":"2024-05-20T09:34:49","slug":"code-blocks-%e4%b8%8b%e5%a6%82%e4%bd%95%e7%94%a8-c-%e8%af%ad%e8%a8%80%e7%bc%96%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/300111.html","title":{"rendered":"Code Blocks \u4e0b\u5982\u4f55\u7528 C \u8bed\u8a00\u7f16\u7a0b"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26212321\/fb529b60-463a-4334-81f2-168fbd16533c.webp\" alt=\"Code Blocks \u4e0b\u5982\u4f55\u7528 C \u8bed\u8a00\u7f16\u7a0b\" \/><\/p>\n<p><p>\u5728Code Blocks\u4e2d\u4f7f\u7528C\u8bed\u8a00\u8fdb\u884c\u7f16\u7a0b\u662f\u4e00\u4e2a\u76f8\u5bf9\u7b80\u5355\u5e76\u4e14\u76f4\u89c2\u7684\u8fc7\u7a0b\uff0c\u5b83\u4e3b\u8981\u5305\u62ec<strong>\u5b89\u88c5Code Blocks\u3001\u521b\u5efa\u65b0\u7684C\u9879\u76ee\u3001\u7f16\u5199\u4ee3\u7801\u3001\u7f16\u8bd1\u4e0e\u8fd0\u884c<\/strong>\u4ee5\u53ca<strong>\u8c03\u8bd5\u7a0b\u5e8f<\/strong>\u51e0\u4e2a\u6838\u5fc3\u6b65\u9aa4\u3002\u7279\u522b\u662f<strong>\u521b\u5efa\u65b0\u7684C\u9879\u76ee<\/strong>\uff0c\u8fd9\u662f\u6574\u4e2a\u8fc7\u7a0b\u7684\u5173\u952e\u8d77\u70b9\uff0c\u6d89\u53ca\u5230\u9009\u62e9\u6b63\u786e\u7684\u9879\u76ee\u7c7b\u578b\u3001\u914d\u7f6e\u57fa\u672c\u8bbe\u7f6e\u7b49\uff0c\u4e3a\u540e\u7eed\u7684\u7f16\u7a0b\u5de5\u4f5c\u6253\u4e0b\u575a\u5b9e\u7684\u57fa\u7840\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u89e3\u8bfb\u4ece\u5b89\u88c5Code Blocks\u5230\u4f7f\u7528C\u8bed\u8a00\u7f16\u7a0b\u7684\u6574\u4e2a\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u5b89\u88c5CODE BLOCKS<\/h2>\n<\/p>\n<p><p>Code Blocks\u662f\u4e00\u6b3e\u514d\u8d39\u7684C\u3001C++\u548cFortran\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u53cb\u597d\u7684\u7f16\u7a0b\u73af\u5883\u3002<\/p>\n<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u8bbf\u95eeCode Blocks\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u5305\u3002\u9009\u62e9\u9002\u5408\u81ea\u5df1\u64cd\u4f5c\u7cfb\u7edf\u7684\u7248\u672c\uff0cWindows\u7528\u6237\u4e00\u822c\u9009\u62e9\u5e26\u6709mingw\u7684\u5b89\u88c5\u5305\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u53e6\u5916\u5b89\u88c5\u7f16\u8bd1\u5668\u3002<\/li>\n<li>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u5305\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002\u8fc7\u7a0b\u4e2d\uff0c\u9009\u62e9\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u6216\u8005\u81ea\u5b9a\u4e49\u8def\u5f84\uff0c\u5b89\u88c5\u8fc7\u7a0b\u6bd4\u8f83\u76f4\u63a5\uff0c\u6309\u63d0\u793a\u64cd\u4f5c\u5373\u53ef\u3002<\/li>\n<\/ol>\n<p><h2>\u4e8c\u3001\u521b\u5efa\u65b0\u7684C\u9879\u76ee<\/h2>\n<\/p>\n<p><p>\u4e00\u65e6Code Blocks\u5b89\u88c5\u5b8c\u6210\uff0c\u4e0b\u4e00\u6b65\u662f\u521b\u5efa\u65b0\u7684C\u9879\u76ee\uff0c\u8fd9\u5bf9\u540e\u7eed\u7684\u7f16\u7a0b\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00Code Blocks, \u9009\u62e9\u201cCreate a new project\u201d\uff0c\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u9009\u62e9\u201cConsole application\u201d\u8fdb\u5165\u5411\u5bfc\u754c\u9762\u3002<\/li>\n<li>\u9009\u62e9\u8bed\u8a00\u4e3aC\uff0c\u4e4b\u540e\u7ee7\u7eed\uff0c\u7ed9\u9879\u76ee\u547d\u540d\u5e76\u9009\u62e9\u4e00\u4e2a\u5408\u9002\u7684\u4fdd\u5b58\u8def\u5f84\u3002\u5b8c\u6210\u540e\uff0c\u70b9\u51fb\u201cFinish\u201d\u7ed3\u675f\u672c\u6b65\u9aa4\u3002<\/li>\n<\/ol>\n<p><p><strong>\u521b\u5efa\u9879\u76ee\u7684\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u9009\u62e9\u4e86\u6b63\u786e\u7684\u9879\u76ee\u7c7b\u578b\uff08Console application\uff09\u5e76\u4e14\u8bbe\u7f6e\u4e86\u9879\u76ee\u7684\u540d\u79f0\u53ca\u5b58\u50a8\u4f4d\u7f6e\uff0c\u8fd9\u4e9b\u51b3\u5b9a\u7740\u9879\u76ee\u6587\u4ef6\u7684\u7ec4\u7ec7\u65b9\u5f0f\u4ee5\u53ca\u4ee5\u540e\u7f16\u8bd1\u94fe\u63a5\u7684\u4fbf\u5229\u6027\u3002<\/strong><\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u7f16\u5199\u4ee3\u7801<\/h2>\n<\/p>\n<p><p>\u521b\u5efa\u9879\u76ee\u540e\uff0cCode Blocks\u5c06\u81ea\u52a8\u751f\u6210\u4e00\u4e2a\u7b80\u5355\u7684C\u8bed\u8a00&quot;Hello World&quot;\u793a\u4f8b\u7a0b\u5e8f\uff0c\u8fd9\u662f\u7a0b\u5e8f\u7f16\u5199\u7684\u8d77\u70b9\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5728\u5de6\u4fa7\u7684Project Explorer\u4e2d\u627e\u5230\u4f60\u7684\u9879\u76ee\uff0c\u5c55\u5f00Sources\u6587\u4ef6\u5939\uff0c\u53cc\u51fb\u6253\u5f00m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n.c\u6587\u4ef6\uff0c\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u53ef\u4ee5\u7f16\u5199\u6216\u4fee\u6539\u4f60\u7684C\u8bed\u8a00\u4ee3\u7801\u3002<\/li>\n<li>\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4fee\u6539main\u51fd\u6570\u4e2d\u7684printf\u8bed\u53e5\u6765\u8f93\u51fa\u4e0d\u540c\u7684\u6587\u672c\uff0c\u6216\u8005\u6dfb\u52a0\u66f4\u591a\u7684C\u8bed\u8a00\u4ee3\u7801\u6765\u63a2\u7d22\u4e0d\u540c\u7684C\u8bed\u8a00\u7279\u6027\u3002<\/li>\n<\/ol>\n<p><h2>\u56db\u3001\u7f16\u8bd1\u4e0e\u8fd0\u884c<\/h2>\n<\/p>\n<p><p>\u7f16\u5199\u5b8c\u4ee3\u7801\u540e\uff0c\u4e0b\u4e00\u6b65\u662f\u7f16\u8bd1\u548c\u8fd0\u884c\u4f60\u7684C\u7a0b\u5e8f\uff0c\u4ee5\u68c0\u67e5\u7a0b\u5e8f\u7684\u6b63\u786e\u6027\u5e76\u89c2\u5bdf\u8fd0\u884c\u7ed3\u679c\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5728Code Blocks\u754c\u9762\u7684\u9876\u90e8\u5de5\u5177\u680f\u4e2d\uff0c\u627e\u5230\u5e76\u70b9\u51fb\u7eff\u8272\u7684\u5c0f\u4e09\u89d2\uff08\u6216\u6309F9\u5feb\u6377\u952e\uff09\uff0c\u8fd9\u5c06\u7f16\u8bd1\u5e76\u8fd0\u884c\u4f60\u7684\u7a0b\u5e8f\u3002<\/li>\n<li>\u5982\u679c\u4ee3\u7801\u4e2d\u6ca1\u6709\u9519\u8bef\uff0c\u7f16\u8bd1\u5668\u5c06\u6210\u529f\u7f16\u8bd1\uff0c\u5e76\u4e14IDE\u4f1a\u81ea\u52a8\u8fd0\u884c\u4f60\u7684\u7a0b\u5e8f\u3002\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u679c\u4f1a\u5728\u5e95\u90e8\u7684&quot;Logs &amp; Others&quot;\u7684&quot;Build log&quot;\u6807\u7b7e\u4e2d\u663e\u793a\u3002<\/li>\n<\/ol>\n<p><h2>\u4e94\u3001\u8c03\u8bd5\u7a0b\u5e8f<\/h2>\n<\/p>\n<p><p>\u5728\u7a0b\u5e8f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u8bd5\u662f\u4e0d\u53ef\u907f\u514d\u7684\u3002Code Blocks\u63d0\u4f9b\u4e86\u5b8c\u5584\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u5e2e\u52a9\u5b9a\u4f4d\u548c\u89e3\u51b3\u4ee3\u7801\u4e2d\u7684\u9519\u8bef\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5728\u4f60\u7684\u4ee3\u7801\u4e2d\u8bbe\u7f6e\u65ad\u70b9\uff0c\u4ec5\u9700\u5728\u4ee3\u7801\u884c\u7684\u5de6\u8fb9\u8fb9\u7f18\u70b9\u51fb\u5373\u53ef\u51fa\u73b0\u4e00\u4e2a\u7ea2\u70b9\uff0c\u8868\u793a\u5728\u6b64\u5904\u8bbe\u7f6e\u4e86\u65ad\u70b9\u3002<\/li>\n<li>\u70b9\u51fb\u754c\u9762\u4e0a\u65b9\u7684\u8c03\u8bd5\u56fe\u6807\uff08\u4e00\u4e2a\u5c0f\u866b\u5b50\u7684\u56fe\u6807\uff09\u5f00\u59cb\u8c03\u8bd5\u3002\u4f60\u53ef\u4ee5\u5355\u6b65\u6267\u884c\u4ee3\u7801\u3001\u89c2\u5bdf\u53d8\u91cf\u7684\u503c\u53d8\u5316\uff0c\u76f4\u81f3\u627e\u5230\u7a0b\u5e8f\u4e2d\u7684\u903b\u8f91\u9519\u8bef\u6216\u8005\u8fd0\u884c\u9519\u8bef\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7<strong>\u9010\u6b65\u7ec6\u81f4\u5730\u8c03\u8bd5<\/strong>\uff0c\u53ef\u4ee5\u5e2e\u52a9\u65b0\u624b\u548c\u7ecf\u9a8c\u4e30\u5bcc\u7684\u7a0b\u5e8f\u5458\u67e5\u627e\u5e76\u4fee\u590d\u4ee3\u7801\u4e2d\u7684\u9519\u8bef\uff0c\u63d0\u9ad8\u4ee3\u7801\u7684\u8d28\u91cf\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n<\/p>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0cCode Blocks\u4e3aC\u8bed\u8a00\u7f16\u7a0b\u63d0\u4f9b\u4e86\u4e00\u4e2a\u76f4\u63a5\u3001\u9ad8\u6548\u7684\u5e73\u53f0\u3002\u4ece\u521b\u5efa\u9879\u76ee\u5f00\u59cb\uff0c\u5230\u7f16\u5199\u3001\u7f16\u8bd1\u3001\u8fd0\u884c\u4ee5\u53ca\u8c03\u8bd5\u4ee3\u7801\uff0c\u6bcf\u4e00\u6b65\u90fd\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4fbf\u6377\u7684\u64cd\u4f5c\u65b9\u5f0f\u548c\u5f3a\u5927\u7684\u529f\u80fd\u652f\u6301\uff0c\u662f\u5b66\u4e60\u548c\u4f7f\u7528C\u8bed\u8a00\u7684\u4f18\u79c0\u9009\u62e9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728 Code Blocks \u4e0b\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 C \u8bed\u8a00\u9879\u76ee\uff1f<\/strong><\/p>\n<p>\u5728 Code Blocks \u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 C \u8bed\u8a00\u9879\u76ee\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u6253\u5f00 Code Blocks\uff0c\u7136\u540e\u9009\u62e9 &quot;File&quot; \u83dc\u5355\uff0c\u63a5\u7740\u9009\u62e9 &quot;New&quot;\uff0c\u7136\u540e\u9009\u62e9 &quot;Project&quot;\u3002\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9 &quot;Empty&quot; \u9879\u76ee\u7c7b\u578b\uff0c\u5e76\u786e\u4fdd\u9009\u62e9\u4e86 &quot;C&quot; \u4f5c\u4e3a\u9879\u76ee\u8bed\u8a00\u3002\u6700\u540e\uff0c\u9009\u62e9\u9879\u76ee\u7684\u4fdd\u5b58\u8def\u5f84\u548c\u540d\u79f0\uff0c\u7136\u540e\u70b9\u51fb &quot;Next&quot;\uff0c\u6700\u540e\u70b9\u51fb &quot;Finish&quot; \u5b8c\u6210\u9879\u76ee\u7684\u521b\u5efa\u3002<\/p>\n<p><strong>2. \u5982\u4f55\u5728 Code Blocks \u4e2d\u7f16\u5199\u5e76\u8fd0\u884c\u4e00\u4e2a\u7b80\u5355\u7684 C \u8bed\u8a00\u7a0b\u5e8f\uff1f<\/strong><\/p>\n<p>\u5728 Code Blocks \u4e2d\u7f16\u5199\u548c\u8fd0\u884c C \u8bed\u8a00\u7a0b\u5e8f\u975e\u5e38\u7b80\u5355\u3002\u5728\u9879\u76ee\u4e2d\u9009\u62e9 &quot;Sources&quot; \u6587\u4ef6\u5939\uff0c\u7136\u540e\u53f3\u952e\u70b9\u51fb\uff0c\u9009\u62e9 &quot;Add Files&quot;\u3002\u5728\u5f39\u51fa\u7a97\u53e3\u4e2d\uff0c\u627e\u5230\u4f60\u60f3\u8981\u6dfb\u52a0\u7684 C \u8bed\u8a00\u6e90\u6587\u4ef6\uff0c\u7136\u540e\u70b9\u51fb &quot;Open&quot;\u3002\u63a5\u7740\uff0c\u4f60\u53ef\u4ee5\u5728 Code Blocks \u7684\u7f16\u8f91\u5668\u4e2d\u7f16\u5199\u4f60\u7684 C \u8bed\u8a00\u4ee3\u7801\u3002\u5b8c\u6210\u4ee3\u7801\u7f16\u5199\u540e\uff0c\u70b9\u51fb &quot;Build&quot; \u9009\u9879\u5361\u4e2d\u7684 &quot;Build and Run&quot; \u6309\u94ae\uff0cCode Blocks \u5c06\u4f1a\u7f16\u8bd1\u5e76\u8fd0\u884c\u4f60\u7684\u7a0b\u5e8f\u3002<\/p>\n<p><strong>3. \u5982\u4f55\u5728 Code Blocks \u4e2d\u8c03\u8bd5 C \u8bed\u8a00\u7a0b\u5e8f\uff1f<\/strong><\/p>\n<p>Code Blocks \u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8c03\u8bd5\u529f\u80fd\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u627e\u5230\u7a0b\u5e8f\u4e2d\u7684 bug\u3002\u5728 Code Blocks \u4e2d\u8c03\u8bd5 C \u8bed\u8a00\u7a0b\u5e8f\uff0c\u9996\u5148\u5c06\u7a0b\u5e8f\u8bbe\u7f6e\u4e3a\u8c03\u8bd5\u6a21\u5f0f\u3002\u8fdb\u5165 &quot;Project&quot; \u83dc\u5355\uff0c\u9009\u62e9 &quot;Set Programs&#039; Arguments&quot;\uff0c\u7136\u540e\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u8f93\u5165\u4f60\u7684\u7a0b\u5e8f\u9700\u8981\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff0c\u70b9\u51fb &quot;OK&quot;\u3002\u7136\u540e\uff0c\u5728\u4f60\u60f3\u8981\u8bbe\u7f6e\u65ad\u70b9\u7684\u884c\u4e0a\u70b9\u51fb\u884c\u53f7\uff0c\u5728\u4ee3\u7801\u524d\u9762\u4f1a\u51fa\u73b0\u4e00\u4e2a\u7ea2\u8272\u7684\u5706\u70b9\uff0c\u8868\u793a\u65ad\u70b9\u5df2\u8bbe\u7f6e\u3002\u6700\u540e\uff0c\u70b9\u51fb &quot;Debug&quot; \u9009\u9879\u5361\u4e2d\u7684 &quot;Start\/Continue&quot; \u6309\u94ae\u5f00\u59cb\u8c03\u8bd5\u3002\u8c03\u8bd5\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u53ef\u4ee5\u89c2\u5bdf\u53d8\u91cf\u7684\u503c\u3001\u9010\u884c\u6267\u884c\u4ee3\u7801\uff0c\u5e76\u901a\u8fc7\u8c03\u8bd5\u63a7\u5236\u6309\u94ae\u6765\u63a7\u5236\u7a0b\u5e8f\u7684\u6267\u884c\u6d41\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Code Blocks\u4e2d\u4f7f\u7528C\u8bed\u8a00\u8fdb\u884c\u7f16\u7a0b\u662f\u4e00\u4e2a\u76f8\u5bf9\u7b80\u5355\u5e76\u4e14\u76f4\u89c2\u7684\u8fc7\u7a0b\uff0c\u5b83\u4e3b\u8981\u5305\u62ec\u5b89\u88c5Code Blocks [&hellip;]","protected":false},"author":3,"featured_media":300135,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/300111"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=300111"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/300111\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/300135"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=300111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=300111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=300111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}