{"id":21259,"date":"2024-11-19T16:51:06","date_gmt":"2024-11-19T08:51:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21259\/"},"modified":"2024-11-19T16:51:06","modified_gmt":"2024-11-19T08:51:06","slug":"vscode%e6%80%8e%e4%b9%88%e8%bf%90%e8%a1%8cc%e8%af%ad%e8%a8%80%e4%bb%a3%e7%a0%81-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21259\/","title":{"rendered":"vscode\u600e\u4e48\u8fd0\u884cC\u8bed\u8a00\u4ee3\u7801"},"content":{"rendered":"<blockquote><p>\n  \u5728 vscode \u4e2d\u8fd0\u884c c \u8bed\u8a00\u4ee3\u7801\uff0c\u9700\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5 c\/c++ \u6269\u5c55\uff1b\u914d\u7f6e\u7f16\u8bd1\u5668\u8def\u5f84\uff1b\u521b\u5efa c \u8bed\u8a00\u6587\u4ef6\uff1b\u7f16\u5199 c \u8bed\u8a00\u4ee3\u7801\uff1b\u7f16\u8bd1\u4ee3\u7801\uff1b\u8fd0\u884c\u4ee3\u7801\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u4efb\u52a1\u8fd0\u884c\u5668\u3001\u8c03\u8bd5\u5668\u548c\u5b89\u88c5\u5176\u4ed6\u6269\u5c55\u6765\u589e\u5f3a\u5f00\u53d1\u4f53\u9a8c\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/15\/2024051505002778118.jpg\" class=\"aligncenter\" title=\"vscode\u600e\u4e48\u8fd0\u884cC\u8bed\u8a00\u4ee3\u7801\u63d2\u56fe\" alt=\"vscode\u600e\u4e48\u8fd0\u884cC\u8bed\u8a00\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Visual Studio Code \u4e2d\u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801<\/strong><\/p>\n<p>Visual Studio Code\uff08\u7b80\u79f0 VSCode\uff09\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ec C \u8bed\u8a00\u3002\u4ee5\u4e0b\u6b65\u9aa4\u5c06\u5f15\u5bfc\u4f60\u5982\u4f55\u5728 VSCode \u4e2d\u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 C\/C++ \u6269\u5c55<\/strong><\/p>\n<p>\u5728 VSCode \u4e2d\uff0c\u4f9d\u6b21\u8f6c\u5230\u201c\u6269\u5c55\u201d&gt;\u201c\u641c\u7d22\u6269\u5c55\u201d\uff0c\u641c\u7d22\u5e76\u5b89\u88c5\u201cC\/C++\u201d\u6269\u5c55\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>2. \u914d\u7f6e\u7f16\u8bd1\u5668<\/strong><\/p>\n<p>\u5728\u83dc\u5355\u680f\u4e2d\uff0c\u5355\u51fb\u201c\u6587\u4ef6\u201d&gt;\u201c\u9996\u9009\u9879\u201d&gt;\u201c\u8bbe\u7f6e\u201d\u3002\u5728\u201c\u641c\u7d22\u8bbe\u7f6e\u201d\u680f\u4e2d\u8f93\u5165\u201cC_Cpp.default.compilerPath\u201d\u3002\u8bbe\u7f6e\u6b64\u9009\u9879\u4ee5\u6307\u5411\u4f60\u5df2\u5b89\u88c5\u7684 C \u7f16\u8bd1\u5668\uff08\u4f8b\u5982 GCC \u6216 Clang\uff09\u7684\u8def\u5f84\u3002<\/p>\n<p><strong>3. \u521b\u5efa C \u8bed\u8a00\u6587\u4ef6<\/strong><\/p>\n<p>\u5728 VSCode \u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528\u201c.c\u201d\u4f5c\u4e3a\u6587\u4ef6\u6269\u5c55\u540d\uff08\u4f8b\u5982\uff0c\u201cmain.c\u201d\uff09\u3002<\/p>\n<p><strong>4. \u7f16\u5199 C \u8bed\u8a00\u4ee3\u7801<\/strong><\/p>\n<p>\u7f16\u5199\u4f60\u9700\u8981\u7684 C \u8bed\u8a00\u4ee3\u7801\u3002<\/p>\n<p><strong>5. \u7f16\u8bd1\u4ee3\u7801<\/strong><\/p>\n<p>\u6309 Ctrl+Alt+B\uff08Windows\/Linux\uff09\u6216 Cmd+Option+B\uff08macOS\uff09\u7f16\u8bd1\u4ee3\u7801\u3002<\/p>\n<p><strong>6. \u8fd0\u884c\u4ee3\u7801<\/strong><\/p>\n<p>\u6309 F5 \u6216\u5355\u51fb\u201c\u8fd0\u884c\u201d\u56fe\u6807\uff08\u7eff\u8272\u7bad\u5934\uff09\u8fd0\u884c\u4ee3\u7801\u3002<\/p>\n<p><strong>\u9644\u52a0\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li> <strong>\u4f7f\u7528\u4efb\u52a1\u8fd0\u884c\u5668\uff1a<\/strong>\u5728\u201c.\u201d\u6587\u4ef6\u5939\u4e0b\u521b\u5efa\u4e00\u4e2a\u201ctasks.json\u201d\u6587\u4ef6\uff0c\u5e76\u914d\u7f6e\u4efb\u52a1\u6765\u7f16\u8bd1\u548c\u8fd0\u884c\u4ee3\u7801\u3002<\/li>\n<li> <strong>\u4f7f\u7528\u8c03\u8bd5\u5668\uff1a<\/strong>VSCode \u96c6\u6210\u4e86\u4e00\u4e2a\u8c03\u8bd5\u5668\uff0c\u5141\u8bb8\u4f60\u9010\u6b65\u6267\u884c\u4ee3\u7801\u5e76\u68c0\u67e5\u53d8\u91cf\u503c\u3002<\/li>\n<li> <strong>\u5b89\u88c5\u5176\u4ed6\u6269\u5c55\uff1a<\/strong>\u6709\u8bb8\u591a\u5176\u4ed6\u6269\u5c55\u53ef\u4ee5\u589e\u5f3a VSCode \u4e2d\u7684 C\/C++ \u5f00\u53d1\u4f53\u9a8c\uff0c\u4f8b\u5982\u201cC\/C++ Snippets\u201d\u548c\u201cC\/C++ Intellisense\u201d\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u8fd0\u884cC\u8bed\u8a00\u4ee3\u7801\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>\u5728 vscode \u4e2d\u8fd0\u884c c \u8bed\u8a00\u4ee3\u7801\uff0c\u9700\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5b89\u88c5 c\/c++ \u6269\u5c55\uff1b\u914d\u7f6e\u7f16\u8bd1\u5668\u8def\u5f84\uff1b\u521b\u5efa c \u8bed\u8a00\u6587\u4ef6\uff1b\u7f16\u5199 c \u8bed\u8a00\u4ee3\u7801\uff1b\u7f16\u8bd1\u4ee3\u7801\uff1b\u8fd0\u884c\u4ee3\u7801\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u4efb\u52a1\u8fd0\u884c\u5668\u3001\u8c03\u8bd5\u5668\u548c\u5b89\u88c5\u5176\u4ed6\u6269\u5c55\u6765\u589e\u5f3a\u5f00\u53d1\u4f53\u9a8c\u3002 \u5982\u4f55\u5728 Visual Studio Code \u4e2d\u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801 Visual Studio Code\uff08\u7b80\u79f0 VSCode\uff09\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ec C \u8bed\u8a00\u3002\u4ee5\u4e0b\u6b65\u9aa4\u5c06\u5f15\u5bfc\u4f60\u5982\u4f55\u5728 VSCode \u4e2d\u8fd0\u884c C \u8bed\u8a00\u4ee3\u7801\uff1a 1. \u5b89\u88c5 C\/C++ \u6269\u5c55 \u5728 VSCode \u4e2d\uff0c\u4f9d\u6b21\u8f6c\u5230\u201c\u6269\u5c55\u201d&gt;\u201c\u641c\u7d22\u6269\u5c55\u201d\uff0c\u641c\u7d22\u5e76\u5b89\u88c5\u201cC\/C++\u201d\u6269\u5c55\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b 2. \u914d\u7f6e\u7f16\u8bd1\u5668 \u5728\u83dc\u5355\u680f\u4e2d\uff0c\u5355\u51fb\u201c\u6587\u4ef6\u201d&gt;\u201c\u9996\u9009\u9879\u201d&gt;\u201c\u8bbe\u7f6e\u201d\u3002\u5728\u201c\u641c\u7d22\u8bbe\u7f6e\u201d\u680f\u4e2d\u8f93\u5165\u201cC_Cpp.default.compilerPath\u201d\u3002\u8bbe\u7f6e\u6b64\u9009\u9879\u4ee5\u6307\u5411\u4f60\u5df2\u5b89\u88c5\u7684 C \u7f16\u8bd1\u5668\uff08\u4f8b\u5982 GCC \u6216 Clang\uff09\u7684\u8def\u5f84\u3002 3. \u521b\u5efa C \u8bed\u8a00\u6587\u4ef6 \u5728 VSCode \u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528\u201c.c\u201d\u4f5c\u4e3a\u6587\u4ef6\u6269\u5c55\u540d\uff08\u4f8b\u5982\uff0c\u201cmain.c\u201d\uff09\u3002 4. \u7f16\u5199 C \u8bed\u8a00\u4ee3\u7801 [&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-21259","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21259","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=21259"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21259\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}