{"id":20492,"date":"2024-11-19T12:13:25","date_gmt":"2024-11-19T04:13:25","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20492\/"},"modified":"2024-11-19T12:13:25","modified_gmt":"2024-11-19T04:13:25","slug":"vscode%e6%80%8e%e4%b9%88%e8%bf%90%e8%a1%8c%e4%bb%a3%e7%a0%81c%e8%af%ad%e8%a8%80","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20492\/","title":{"rendered":"vscode\u600e\u4e48\u8fd0\u884c\u4ee3\u7801C\u8bed\u8a00"},"content":{"rendered":"<blockquote><p>\n  \u8981\u4f7f\u7528 visual studio code \u8fd0\u884c c \u8bed\u8a00\u4ee3\u7801\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5 c\/c++ \u6269\u5c55\u5e76\u8bbe\u7f6e\u7f16\u8bd1\u5668\u3002\u521b\u5efa c \u8bed\u8a00\u6587\u4ef6\u5e76\u8f93\u5165\u4ee3\u7801\u3002\u4f7f\u7528\u7ec8\u7aef\u7f16\u8bd1\u5e76\u8fd0\u884c\u4ee3\u7801\uff08\u6216\u4f7f\u7528\u8c03\u8bd5\u5668\u8fd0\u884c\u4ee3\u7801\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/03\/2024040301182049069.jpg\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fd0\u884c\u4ee3\u7801C\u8bed\u8a00\u63d2\u56fe\" alt=\"vscode\u600e\u4e48\u8fd0\u884c\u4ee3\u7801C\u8bed\u8a00\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Visual Studio Code \u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801<\/strong><\/p>\n<p>\u8981\u4f7f\u7528 Visual Studio Code (VS Code) \u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 C\/C++ \u6269\u5c55<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 VS Code\uff0c\u9009\u62e9\u201c\u6269\u5c55\u201d\u89c6\u56fe\uff08Ctrl\/Cmd + Shift + X\uff09\u3002<\/li>\n<li>\u5728\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201cC\/C++\u201d\uff0c\u7136\u540e\u5b89\u88c5\u201cMicrosoft C\/C++\u201d\u6269\u5c55\u3002<\/li>\n<\/ul>\n<p><strong>2. \u8bbe\u7f6e\u7f16\u8bd1\u5668<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ul>\n<li>\u5728 VS Code \u4e2d\uff0c\u6253\u5f00\u201c\u8bbe\u7f6e\u201d\u89c6\u56fe\uff08Ctrl\/Cmd + ,\uff09\u3002<\/li>\n<li>\u5728\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201cC_Cpp.default.compilerPath\u201d\uff0c\u5c06\u7f16\u8bd1\u5668\u8def\u5f84\u8bbe\u7f6e\u4e3a GCC \u6216 Clang \u7b49\u7f16\u8bd1\u5668\u3002<\/li>\n<\/ul>\n<p><strong>3. \u521b\u5efa C \u8bed\u8a00\u6587\u4ef6<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cmain.c\u201d\u7684\u6587\u4ef6\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/li>\n<\/ul>\n<pre>#include &lt;stdio.h&gt;\n\nint main() {\n    printf(\"Hello, world!\n\");\n    return 0;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u4f7f\u7528\u7ec8\u7aef\u8fd0\u884c\u4ee3\u7801<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 VS Code \u7684\u96c6\u6210\u7ec8\u7aef\uff08Ctrl\/Cmd + `\uff09\u3002<\/li>\n<li>\u5bfc\u822a\u5230\u4ee3\u7801\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u7f16\u8bd1\u5e76\u8fd0\u884c\u4ee3\u7801\uff1a<\/li>\n<\/ul>\n<pre>gcc main.c -o main\n.\/main<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u4f7f\u7528\u8c03\u8bd5\u5668\u8fd0\u884c\u4ee3\u7801<\/strong><\/p>\n<ul>\n<li>\u70b9\u51fb VS Code \u5de6\u4fa7\u83dc\u5355\u680f\u4e2d\u7684\u201c\u8c03\u8bd5\u201d\u56fe\u6807\u3002<\/li>\n<li>\u5728\u201c\u542f\u52a8\u914d\u7f6e\u201d\u4e0b\u62c9\u83dc\u5355\u4e2d\uff0c\u9009\u62e9\u201cC\/C++: gdb\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u8fd0\u884c\u201d\u6309\u94ae\u5f00\u59cb\u8c03\u8bd5\u3002<\/li>\n<\/ul>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u5df2\u5b89\u88c5 GCC \u6216 Clang \u7f16\u8bd1\u5668\u3002<\/li>\n<li>\u5982\u679c\u8fd0\u884c\u65f6\u9047\u5230\u9519\u8bef\uff0c\u8bf7\u4ed4\u7ec6\u68c0\u67e5\u4ee3\u7801\u548c\u547d\u4ee4\u3002<\/li>\n<li>VS Code \u8fd8\u63d0\u4f9b\u5176\u4ed6\u9009\u9879\u6765\u7f16\u8bd1\u548c\u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801\uff0c\u4f8b\u5982\u4f7f\u7528\u4efb\u52a1\u6216\u6269\u5c55\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u8fd0\u884c\u4ee3\u7801C\u8bed\u8a00\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u4f7f\u7528 visual studio code \u8fd0\u884c c \u8bed\u8a00\u4ee3\u7801\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5 c\/c++ \u6269\u5c55\u5e76\u8bbe\u7f6e\u7f16\u8bd1\u5668\u3002\u521b\u5efa c \u8bed\u8a00\u6587\u4ef6\u5e76\u8f93\u5165\u4ee3\u7801\u3002\u4f7f\u7528\u7ec8\u7aef\u7f16\u8bd1\u5e76\u8fd0\u884c\u4ee3\u7801\uff08\u6216\u4f7f\u7528\u8c03\u8bd5\u5668\u8fd0\u884c\u4ee3\u7801\uff09\u3002 \u5982\u4f55\u4f7f\u7528 Visual Studio Code \u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801 \u8981\u4f7f\u7528 Visual Studio Code (VS Code) \u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u5b89\u88c5 C\/C++ \u6269\u5c55 \u6253\u5f00 VS Code\uff0c\u9009\u62e9\u201c\u6269\u5c55\u201d\u89c6\u56fe\uff08Ctrl\/Cmd + Shift + X\uff09\u3002 \u5728\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201cC\/C++\u201d\uff0c\u7136\u540e\u5b89\u88c5\u201cMicrosoft C\/C++\u201d\u6269\u5c55\u3002 2. \u8bbe\u7f6e\u7f16\u8bd1\u5668 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5728 VS Code \u4e2d\uff0c\u6253\u5f00\u201c\u8bbe\u7f6e\u201d\u89c6\u56fe\uff08Ctrl\/Cmd + ,\uff09\u3002 \u5728\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201cC_Cpp.default.compilerPath\u201d\uff0c\u5c06\u7f16\u8bd1\u5668\u8def\u5f84\u8bbe\u7f6e\u4e3a GCC \u6216 Clang \u7b49\u7f16\u8bd1\u5668\u3002 3. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-20492","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=20492"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20492\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}