{"id":36,"date":"2026-08-19T20:14:50","date_gmt":"2026-08-19T12:14:50","guid":{"rendered":"http:\/\/38.60.212.63:8080\/?p=36"},"modified":"2026-08-19T20:14:52","modified_gmt":"2026-08-19T12:14:52","slug":"02-c%e8%af%ad%e8%a8%80%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/decagrammaton.xyz\/?p=36","title":{"rendered":"02-C\u8bed\u8a00\u73af\u5883\u642d\u5efa"},"content":{"rendered":"\n<h2 id=\"\u672c\u6587\u5185\u5bb9\">\u672c\u6587\u5185\u5bb9<\/h2>\n<ul>\n<li>\u73af\u5883\u642d\u5efa<\/li>\n<li>\u7f16\u5199\u7b2c\u4e00\u4e2a\u7a0b\u5e8f<\/li>\n<li>\u7f16\u8bd1\u4e0e\u8fd0\u884c<\/li>\n<li>\u5e38\u89c1\u95ee\u9898<\/li>\n<\/ul>\n<h1 id=\"\u73af\u5883\u642d\u5efa\">\u73af\u5883\u642d\u5efa<\/h1>\n<p>\u8fd9\u662f\u4e00\u4e2a\u57fa\u4e8eVSCode+GCC\u7684\u73af\u5883\u642d\u5efa<\/p>\n<h3 id=\"\u6b65\u9aa4windows\">\u6b65\u9aa4\uff08windows\uff09<\/h3>\n<ol type=\"1\">\n<li>\u5b89\u88c5 VS Code<\/li>\n<\/ol>\n<p><a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\"  rel=\"nofollow\" >Visual Studio\nCode\u5b98\u65b9\u4e0b\u8f7d<\/a><\/p>\n<p>\u5b89\u88c5 C\/C++ \u63d2\u4ef6\uff1a<\/p>\n<p>\u6253\u5f00 VS Code Extensions \u641c\u7d22\uff1a C\/C++<\/p>\n<p>\u5b89\u88c5 Microsoft \u53d1\u5e03\u7684\u63d2\u4ef6\u3002<\/p>\n<ol start=\"2\" type=\"1\">\n<li>\u5b89\u88c5 GCC \u7f16\u8bd1\u5668<\/li>\n<\/ol>\n<p>\u63a8\u8350\u4f7f\u7528 MSYS2 \u63d0\u4f9b\u7684 MinGW-w64 UCRT64 \u5de5\u5177\u94fe\u3002<\/p>\n<p>MSYS2 \u662f\u4e00\u4e2a Windows \u4e0b\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u73af\u5883\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5b89\u88c5 GCC\n\u7b49\u5f00\u53d1\u5de5\u5177\u3002<\/p>\n<p>\u4e0b\u8f7d\uff1a<\/p>\n<p><a href=\"https:\/\/www.msys2.org\/\" target=\"_blank\"  rel=\"nofollow\" >MSYS2 \u5b98\u65b9\u7f51\u7ad9<\/a><\/p>\n<p>\u5b89\u88c5\u540e\u6253\u5f00 MSYS2 \u7ec8\u7aef\uff1a<\/p>\n<p>\u6267\u884c\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb1\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">pacman<\/span> <span class=\"at\">-Syu<\/span><\/span><\/code><\/pre><\/div>\n<p>\u7136\u540e\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb2\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">pacman<\/span> <span class=\"at\">-S<\/span> mingw-w64-ucrt-x86_64-gcc<\/span><\/code><\/pre><\/div>\n<p>\u6d4b\u8bd5\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb3\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> <span class=\"at\">--version<\/span><\/span><\/code><\/pre><\/div>\n<p>\u51fa\u73b0\u7248\u672c\u4fe1\u606f\u8868\u793a\u6210\u529f\u3002<\/p>\n<ol start=\"3\" type=\"1\">\n<li>\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/li>\n<\/ol>\n<p>\u628a GCC \u7684 bin \u76ee\u5f55\u52a0\u5165 Path\uff0c\u4f8b\u5982\uff1a<\/p>\n<p>C:<\/p>\n<p>\u91cd\u65b0\u6253\u5f00\u7ec8\u7aef\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb4\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> <span class=\"at\">--version<\/span><\/span><\/code><\/pre><\/div>\n<p>\u80fd\u663e\u793a\u7248\u672c\u5373\u53ef\u3002<\/p>\n<ol start=\"4\" type=\"1\">\n<li>\u7f16\u8bd1\u8fd0\u884c<\/li>\n<\/ol>\n<p>\u521b\u5efa\uff1a<\/p>\n<p>hello.c<\/p>\n<p>\u5185\u5bb9\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb5\"><pre class=\"sourceCode c\"><code class=\"sourceCode c\"><span id=\"cb5-1\"><a href=\"#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"pp\">#include <\/span><span class=\"im\">&lt;stdio.h&gt;<\/span><\/span>\n<span id=\"cb5-2\"><a href=\"#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><\/span>\n<span id=\"cb5-3\"><a href=\"#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"dt\">int<\/span> main<span class=\"op\">()<\/span><\/span>\n<span id=\"cb5-4\"><a href=\"#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"op\">{<\/span><\/span>\n<span id=\"cb5-5\"><a href=\"#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a>    printf<span class=\"op\">(<\/span><span class=\"st\">\"Hello World<\/span><span class=\"sc\">\\n<\/span><span class=\"st\">\"<\/span><span class=\"op\">);<\/span><\/span>\n<span id=\"cb5-6\"><a href=\"#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a>    <span class=\"cf\">return<\/span> <span class=\"dv\">0<\/span><span class=\"op\">;<\/span><\/span>\n<span id=\"cb5-7\"><a href=\"#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"op\">}<\/span><\/span><\/code><\/pre><\/div>\n<p>\u7ec8\u7aef\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb6\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> hello.c <span class=\"at\">-o<\/span> hello<\/span><\/code><\/pre><\/div>\n<p>\u8fd0\u884c\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb7\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">hello<\/span><\/span><\/code><\/pre><\/div>\n<p>\u8f93\u51fa\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb8\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">Hello<\/span> World<\/span><\/code><\/pre><\/div>\n<h3 id=\"\u6b65\u9aa4linux\">\u6b65\u9aa4\uff08Linux\uff09<\/h3>\n<p>Linux \u901a\u5e38\u81ea\u5e26 GCC\u3002<\/p>\n<div class=\"sourceCode\" id=\"cb9\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"co\"># Debian \/ Ubuntu<\/span><\/span>\n<span id=\"cb9-2\"><a href=\"#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">sudo<\/span> apt install build-essential gdb<\/span>\n<span id=\"cb9-3\"><a href=\"#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><\/span>\n<span id=\"cb9-4\"><a href=\"#cb9-4\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"co\"># Fedora<\/span><\/span>\n<span id=\"cb9-5\"><a href=\"#cb9-5\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">sudo<\/span> dnf install gcc gcc-c++ gdb make<\/span>\n<span id=\"cb9-6\"><a href=\"#cb9-6\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><\/span>\n<span id=\"cb9-7\"><a href=\"#cb9-7\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"co\"># Arch Linux<\/span><\/span>\n<span id=\"cb9-8\"><a href=\"#cb9-8\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">sudo<\/span> pacman <span class=\"at\">-S<\/span> base-devel gcc gdb<\/span><\/code><\/pre><\/div>\n<p>\u68c0\u67e5\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb10\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> <span class=\"at\">--version<\/span><\/span><\/code><\/pre><\/div>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb11\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb11-1\"><a href=\"#cb11-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> main.c <span class=\"at\">-o<\/span> main<\/span><\/code><\/pre><\/div>\n<p>\u8fd0\u884c\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb12\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb12-1\"><a href=\"#cb12-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">.\/main<\/span><\/span><\/code><\/pre><\/div>\n<h1 id=\"\u7f16\u5199\u7b2c\u4e00\u4e2a\u7a0b\u5e8f\">\u7f16\u5199\u7b2c\u4e00\u4e2a\u7a0b\u5e8f<\/h1>\n<p>\u521b\u5efa\uff1a<\/p>\n<pre><code>hello.c<\/code><\/pre>\n<p>\u8f93\u5165\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb14\"><pre class=\"sourceCode c\"><code class=\"sourceCode c\"><span id=\"cb14-1\"><a href=\"#cb14-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"pp\">#include <\/span><span class=\"im\">&lt;stdio.h&gt;<\/span><\/span>\n<span id=\"cb14-2\"><a href=\"#cb14-2\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><\/span>\n<span id=\"cb14-3\"><a href=\"#cb14-3\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"dt\">int<\/span> main<span class=\"op\">()<\/span><\/span>\n<span id=\"cb14-4\"><a href=\"#cb14-4\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"op\">{<\/span><\/span>\n<span id=\"cb14-5\"><a href=\"#cb14-5\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a>    printf<span class=\"op\">(<\/span><span class=\"st\">\"Hello World<\/span><span class=\"sc\">\\n<\/span><span class=\"st\">\"<\/span><span class=\"op\">);<\/span><\/span>\n<span id=\"cb14-6\"><a href=\"#cb14-6\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a>    <span class=\"cf\">return<\/span> <span class=\"dv\">0<\/span><span class=\"op\">;<\/span><\/span>\n<span id=\"cb14-7\"><a href=\"#cb14-7\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"op\">}<\/span><\/span><\/code><\/pre><\/div>\n<hr>\n<h1 id=\"\u7f16\u8bd1\u4e0e\u8fd0\u884c\">\u7f16\u8bd1\u4e0e\u8fd0\u884c<\/h1>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb15\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb15-1\"><a href=\"#cb15-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> hello.c <span class=\"at\">-o<\/span> hello<\/span><\/code><\/pre><\/div>\n<p>\u8fd0\u884c\uff1a<\/p>\n<p>Windows:<\/p>\n<div class=\"sourceCode\" id=\"cb16\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb16-1\"><a href=\"#cb16-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">hello<\/span><\/span><\/code><\/pre><\/div>\n<p>Linux:<\/p>\n<div class=\"sourceCode\" id=\"cb17\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb17-1\"><a href=\"#cb17-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"ex\">.\/hello<\/span><\/span><\/code><\/pre><\/div>\n<p>\u8f93\u51fa\uff1a<\/p>\n<pre><code>Hello World<\/code><\/pre>\n<hr>\n<h1 id=\"\u5e38\u89c1\u95ee\u9898-1\">\u5e38\u89c1\u95ee\u9898<\/h1>\n<h2 id=\"gcc-\u4e0d\u662f\u5185\u90e8\u6216\u5916\u90e8\u547d\u4ee4\">gcc \u4e0d\u662f\u5185\u90e8\u6216\u5916\u90e8\u547d\u4ee4<\/h2>\n<p>\u539f\u56e0\uff1a<\/p>\n<ul>\n<li>GCC \u6ca1\u6709\u5b89\u88c5<\/li>\n<li>Path \u6ca1\u6709\u914d\u7f6e<\/li>\n<li>\u7ec8\u7aef\u6ca1\u6709\u91cd\u65b0\u6253\u5f00<\/li>\n<\/ul>\n<p>\u68c0\u67e5\uff1a<\/p>\n<div class=\"sourceCode\" id=\"cb19\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb19-1\"><a href=\"#cb19-1\" aria-hidden=\"true\" tabindex=\"-1\" target=\"_blank\"  rel=\"nofollow\" ><\/a><span class=\"fu\">gcc<\/span> <span class=\"at\">--version<\/span><\/span><\/code><\/pre><\/div>\n<p>\u91cd\u65b0\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u540e\u518d\u6b21\u5c1d\u8bd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5185\u5bb9 \u73af\u5883\u642d\u5efa \u7f16\u5199\u7b2c\u4e00\u4e2a\u7a0b\u5e8f \u7f16\u8bd1\u4e0e\u8fd0\u884c \u5e38\u89c1\u95ee\u9898 \u73af\u5883\u642d\u5efa \u8fd9\u662f\u4e00\u4e2a\u57fa\u4e8eVSCode+GCC\u7684\u73af\u5883\u642d\u5efa \u6b65\u9aa4\uff08window &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":2,"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/decagrammaton.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}