{"id":13097,"date":"2021-01-03T05:48:20","date_gmt":"2021-01-02T21:48:20","guid":{"rendered":"http:\/\/blog.idc.net\/13097\/"},"modified":"2021-01-03T05:48:20","modified_gmt":"2021-01-02T21:48:20","slug":"ubuntu%e4%b8%8b%e7%bb%88%e7%ab%afvim%e7%bc%96%e5%86%99c%e8%af%ad%e8%a8%80%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/13097\/","title":{"rendered":"Ubuntu\u4e0b\u7ec8\u7aefVim\u7f16\u5199C\u8bed\u8a00\u7a0b\u5e8f"},"content":{"rendered":"<div class=\"idc_table\">\n<p>\u6211\u662f\u5f00\u865a\u62df\u673a\u4e0b\u7684Ubuntu,\u88c5\u53cc\u7cfb\u7edf\u53c8\u5378\u4e86\uff0cUbuntu\u9ed8\u8ba4\u662f\u4e0d\u5305\u542b\u7f16\u8f91\u5668vim\u548c\u7f16\u8bd1\u5668gcc\u3002\u5982\u679c\u4f60\u662f\u521a\u5b89\u88c5\u597d\u7684Ubuntu\u7535\u8111\uff0c\u4e0b\u9762\u6211\u4eec\u5c06\u6765\u5b9e\u73b0\u81ea\u5df1\u7684\u7b2c\u4e00\u4e2a\u7a0b\u5e8f\u3002<\/p>\n<p>1.\u51c6\u5907\u5de5\u4f5c<\/p>\n<p>\u9996\u5148\u8fdb\u5165root\u7528\u6237\u6a21\u5f0f\uff0c\u4e0d\u7136\u4e0d\u80fd\u4fdd\u5b58.c \u6587\u4ef6<\/p>\n<p>1.1 \u6253\u5f00\u7ec8\u7aef\uff1a\u4f7f\u7528\u5feb\u6377\u952e Ctrl + Alt + T\uff1b<\/p>\n<p>1.2 \u5b89\u88c5vim\uff1a\u8f93\u5165 sudo apt-get install vim\uff1b\uff08\u6ca1\u5b89\u88c5\u7684\u8bdd\u597d\u50cf\u63d2\u5165\u6a21\u5f0f\u4e2d \u4e0a\u4e0b\u5de6\u53f3 \u548c\u5176\u4ed6\u4e8b\u4e0d\u7075\u7684\uff09<\/p>\n<p>1.3 \u5b89\u88c5gcc\uff1a\u8f93\u5165 sudo apt-get install g++\u3002<\/p>\n<p>2.\u7f16\u5199\uff0c\u7f16\u8bd1\uff0c\u8fd0\u884c<\/p>\n<p>2.1\uff1a\u6253\u5f00\u7ec8\u7aef\uff0c\u968f\u4fbf\u8fdb\u5165\u4e00\u4e2a\u6587\u4ef6\u5939\u7528\u4e8e\u5b58\u653e\u4f60\u7f16\u5199\u7684\u7a0b\u5e8f<\/p>\n<p>#vi hello.c<\/p>\n<p>\u63a5\u7740\u4f60\u5c31\u4f1a\u770b\u5230vi\u7f16\u8f91\u5668\uff0c\u6309i\u5f00\u59cb\u8f93\u5165\uff08\u8f93\u5165i\u540e\u4e0d\u9700\u8981\u56de\u8f66\uff09\uff0c\u63a5\u7740\u76f4\u63a5\u8f93\u5165\u4f60\u7684\u4ee3\u7801\uff0c(\u5982\u679c\u4f60\u4e0d\u4f1a\u7528VIM \u53ef\u4ee5\u81ea\u5df1\u53bb\u5148\u4e86\u89e3\u4e00\u54c8\uff0c\u73b0\u5728\u6211\u5176\u5b9e\u4e5f\u4e0d\u592a\u61c2VIM\u7684\u8be6\u7ec6\u64cd\u4f5c)<\/p>\n<p>\u8f93\u5b8c\u540e\u6309Esc\uff0c\u518d\u8f93\u5165\":wq\"\uff08\u5f15\u53f7\u5185\uff09\u4fdd\u5b58\u9000\u51fa\uff0c<\/p>\n<p>2.2\uff1a\u7528gcc\u7f16\u8bd1\u4f60\u7684\u7a0b\u5e8f<\/p>\n<p>\u5728\u7ec8\u7aef\u8f93\u5165<\/p>\n<p>#sudo gcc -Wall hello.c -o hello<\/p>\n<p>\u7f16\u8bd1\u5b8c\u6210\u540e\uff0c\u5728\u4f60\u7684\u6587\u4ef6\u4e2d\u51fa\u73b0\u4e00\u4e2ahello\u8fd0\u884c\u6587\u4ef6\u3002<\/p>\n<p>2.3\uff1a\u8fd0\u884c\u7f16\u8bd1\u597d\u5230Hello\uff08\u6ce8\u610f\u5927\u5c0f\u5199\uff09\u6587\u4ef6\uff0c\u5728\u7ec8\u7aef\u8f93\u5165<\/p>\n<p>#.\/Hello<\/p>\n<p><strong>\u8fd0\u884c.cpp\u6587\u4ef6\u5219\u9700\u8981\u5b89\u88c5g++<\/strong><\/p>\n<p>\u5b89\u88c5g++<\/p>\n<p>sudo apt-get install g++<\/p>\n<p>vi hello.cpp<\/p>\n<p>g++ -o hello hello.cpp<\/p>\n<p>.\/hello<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u662f\u5f00\u865a\u62df\u673a\u4e0b\u7684Ubuntu,\u88c5\u53cc\u7cfb\u7edf\u53c8\u5378\u4e86\uff0cUbuntu\u9ed8\u8ba4\u662f\u4e0d\u5305\u542b\u7f16\u8f91\u5668vim\u548c\u7f16\u8bd1\u5668gcc\u3002\u5982\u679c\u4f60\u662f\u521a\u5b89 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-13097","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/13097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=13097"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/13097\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=13097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=13097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=13097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}