{"id":15170,"date":"2023-06-12T20:08:09","date_gmt":"2023-06-12T12:08:09","guid":{"rendered":"https:\/\/www.linuxcool.com\/lbyccxzbdcml"},"modified":"2023-06-12T20:08:09","modified_gmt":"2023-06-12T12:08:09","slug":"lbyccxzbdcml","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/lbyccxzbdcml","title":{"rendered":"Linux\u7f16\u8bd1C\u7a0b\u5e8f\u627e\u4e0d\u5230cc\u547d\u4ee4\uff1f"},"content":{"rendered":"<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728<a style='color:#0000CC' href='https:\/\/www.linuxprobe.com\/' target='_blank' rel=\"noopener\">Linux<\/a><a style='color:#0000CC' href='https:\/\/www.linuxdown.com\/' target='_blank' rel=\"noopener\">\u7cfb\u7edf<\/a>\u4e0b\u7f16\u8bd1C\u7a0b\u5e8f\u65f6<strong>linux\u627e\u4e0d\u5230cc<a style='color:#0000CC' href='https:\/\/www.linuxcool.com\/' target='_blank' rel=\"noopener\">\u547d\u4ee4<\/a><\/strong>\uff0c\u7ecf\u5e38\u4f1a\u4f7f\u7528gcc\u548ccc\u547d\u4ee4\u3002\u4f46\u6709\u65f6\u5019\u5728\u4f7f\u7528cc\u547d\u4ee4\u65f6<strong>linux\u627e\u4e0d\u5230cc\u547d\u4ee4<\/strong>\uff0c\u5374\u4f1a\u63d0\u793a\u201ccommand not found\u201d\uff0c\u5373\u627e\u4e0d\u5230cc\u547d\u4ee4\u3002\u8fd9\u662f\u600e\u4e48\u56de\u4e8b\u5462\uff1f\u672c\u6587\u5c06\u4ece8\u4e2a\u65b9\u9762\u5bf9\u8fd9\u4e2a\u95ee\u9898\u8fdb\u884c\u9010\u6b65\u5206\u6790\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>1. cc\u547d\u4ee4\u662f\u4ec0\u4e48<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>cc\uff08C compiler\uff09\u547d\u4ee4\u662fUnix\/Linux\u64cd\u4f5c\u7cfb\u7edf\u4e0b\u7684C\u8bed\u8a00\u7f16\u8bd1\u5668\uff0c\u7528\u4e8e\u5c06C\u6e90\u4ee3\u7801\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5728\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u4e2d\uff0ccc\u547d\u4ee4\u90fd\u662fgcc\u7684\u4e00\u4e2a\u94fe\u63a5linux \u5220\u9664\u6587\u4ef6\uff0c\u56e0\u6b64\u53ef\u4ee5\u901a\u8fc7gcc\u6765\u4f7f\u7528cc\u547d\u4ee4\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>2. cc\u547d\u4ee4\u7684\u67e5\u627e\u8def\u5f84<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5f53\u7528\u6237\u5728\u7ec8\u7aef\u8f93\u5165cc\u547d\u4ee4\u65f6\uff0c\u7cfb\u7edf\u4f1a\u6309\u7167\u4e00\u5b9a\u7684\u67e5\u627e\u8def\u5f84\u53bb\u5bfb\u627e\u8fd9\u4e2a\u547d\u4ee4\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\uff0cLinux\u7cfb\u7edf\u4f1a\u5c06\/usr\/bin\u548c\/usr\/local\/bin\u76ee\u5f55\u6dfb\u52a0\u5230PATH\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u5982\u679ccc\u547d\u4ee4\u6ca1\u6709\u88ab\u5b89\u88c5\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e0b\uff0c\u90a3\u4e48\u7cfb\u7edf\u5c31\u65e0\u6cd5\u627e\u5230\u5b83\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>3. cc\u547d\u4ee4\u662f\u5426\u88ab\u5b89\u88c5<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u7cfb\u7edf\u65e0\u6cd5\u627e\u5230cc\u547d\u4ee4\uff0c\u90a3\u4e48\u7b2c\u4e00\u4ef6\u4e8b\u5c31\u662f\u8981\u786e\u8ba4\u8be5\u547d\u4ee4\u662f\u5426\u5df2\u7ecf\u88ab\u5b89\u88c5\u4e86\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u6765\u68c0\u67e5\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\uff081\uff09\u4f7f\u7528which\u547d\u4ee4\u67e5\u770b<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ which cc\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u8f93\u51fa\u7ed3\u679c\u4e3a\u7a7a\uff0c\u5219\u8bf4\u660e\u8be5\u547d\u4ee4\u6ca1\u6709\u88ab\u5b89\u88c5\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\uff082\uff09\u4f7f\u7528find\u547d\u4ee4\u67e5\u627e<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ find \/-name cc\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5728\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u67e5\u627ecc\u547d\u4ee4\uff0c\u5982\u679c\u627e\u5230\u4e86\uff0c\u5219\u4f1a\u8f93\u51facc\u547d\u4ee4\u6240\u5728\u7684\u8def\u5f84\u3002\u5982\u679c\u6ca1\u6709\u627e\u5230\uff0c\u5219\u4f1a\u8f93\u51fa\u4e00\u4e9b\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>4. cc\u547d\u4ee4\u662f\u5426\u88ab\u5220\u9664<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6709\u65f6\u5019\uff0c\u7528\u6237\u53ef\u80fd\u4f1a\u8bef\u64cd\u4f5c\u5c06cc\u547d\u4ee4\u5220\u9664\u4e86\u3002\u5982\u679c\u662f\u8fd9\u79cd\u60c5\u51b5\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u91cd\u65b0\u5b89\u88c5cc\u547d\u4ee4\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>5. gcc\u662f\u5426\u88ab\u5b89\u88c5<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u524d\u9762\u63d0\u5230\u8fc7\uff0c\u5728\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u4e2d\uff0ccc\u547d\u4ee4\u90fd\u662fgcc\u7684\u4e00\u4e2a\u94fe\u63a5\u3002\u56e0\u6b64\uff0c\u5982\u679cgcc\u6ca1\u6709\u88ab\u6b63\u786e\u5b89\u88c5\uff0c\u90a3\u4e48\u4e5f\u65e0\u6cd5\u4f7f\u7528cc\u547d\u4ee4\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5gcc\u662f\u5426\u5df2\u7ecf\u88ab\u5b89\u88c5\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ gcc -v\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u8f93\u51fagcc\u7248\u672c\u53f7\uff0c\u5219\u8bf4\u660e\u5df2\u7ecf\u5b89\u88c5\u6210\u529f\uff1b\u5426\u5219\u9700\u8981\u91cd\u65b0\u5b89\u88c5\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>6. PATH\u73af\u5883\u53d8\u91cf\u662f\u5426\u88ab\u4fee\u6539<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>PATH\u73af\u5883\u53d8\u91cf\u6307\u5b9a\u4e86\u7cfb\u7edf\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u88ab\u4fee\u6539\u4e86\uff0c\u90a3\u4e48\u7cfb\u7edf\u5c31\u65e0\u6cd5\u627e\u5230cc\u547d\u4ee4\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u67e5\u770bPATH\u73af\u5883\u53d8\u91cf\u7684\u503c\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:350px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2023\/06\/1686571689819_0.png' alt='linux\u538b\u7f29\u547d\u4ee4zip\u547d\u4ee4_linux\u547d\u4ee4_linux\u627e\u4e0d\u5230cc\u547d\u4ee4' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ echo $PATH\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679cPATH\u73af\u5883\u53d8\u91cf\u4e0d\u5305\u542b\/usr\/bin\u548c\/usr\/local\/bin\u76ee\u5f55linux\u516c\u793e\uff0c\u5219\u9700\u8981\u624b\u52a8\u6dfb\u52a0\u8fd9\u4e24\u4e2a\u76ee\u5f55\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ export PATH=$PATH:\/usr\/bin:\/usr\/local\/bin\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>7.\u662f\u5426\u5b58\u5728\u8f6f\u94fe\u63a5<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6709\u65f6\u5019\uff0ccc\u547d\u4ee4\u53ef\u80fd\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u8f6f\u94fe\u63a5\uff0c\u800c\u4e0d\u662f\u4e00\u4e2a\u5b9e\u9645\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u67e5\u770bcc\u547d\u4ee4\u662f\u5426\u662f\u4e00\u4e2a\u8f6f\u94fe\u63a5\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ ls -l$(which cc)\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u8f93\u51fa\u7ed3\u679c\u4e2d\u5305\u542b\u201c-&gt;\u201d\uff0c\u5219\u8bf4\u660ecc\u547d\u4ee4\u662f\u4e00\u4e2a\u8f6f\u94fe\u63a5\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u5220\u9664\u8be5\u8f6f\u94fe\u63a5\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>bash\n$ sudo rm $(which cc)\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>8.\u662f\u5426\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5185\u6838<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u4e00\u4e9b\u7279\u6b8a\u7684\u60c5\u51b5\u4e0b\uff0ccc\u547d\u4ee4\u53ef\u80fd\u4f1a\u88ab\u5185\u6838\u6a21\u5757\u6240\u4f7f\u7528\u3002\u5982\u679c\u8fd9\u4e2a\u5185\u6838\u6a21\u5757\u88ab\u5220\u9664\u6216\u8005\u5347\u7ea7\u4e86\uff0c\u5c31\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5185\u6838\uff0c\u4ee5\u4fbf\u8ba9\u7cfb\u7edf\u80fd\u591f\u6b63\u786e\u5730\u627e\u5230cc\u547d\u4ee4\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u7efc\u4e0a\u6240\u8ff0\uff0c\u5f53Linux\u7cfb\u7edf\u627e\u4e0d\u5230cc\u547d\u4ee4\u65f6\uff0c\u9700\u8981\u4ece\u591a\u4e2a\u65b9\u9762\u8fdb\u884c\u6392\u67e5\u3002\u53ea\u6709\u627e\u5230\u4e86\u95ee\u9898\u7684\u6839\u6e90\uff0c\u624d\u80fd\u91c7\u53d6\u76f8\u5e94\u7684\u63aa\u65bd\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Linux\u7cfb\u7edf\u4e0b\u7f16\u8bd1C\u7a0b\u5e8f\u65f6\uff0c\u7ecf\u5e38\u4f1a\u4f7f\u7528gcc\u548ccc\u547d\u4ee4\u3002found\u201d\uff0c\u5373\u627e\u4e0d\u5230cc\u547d\u4ee4\u3002compiler\uff09\u547d\u4ee4\u662fUnix\/Linux\u64cd\u4f5c\u7cfb\u7edf\u4e0b\u7684C\u8bed\u8a00\u7f16\u8bd1\u5668\uff0c\u7528\u4e8e\u5c06C\u6e90\u4ee3\u7801\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5982\u679ccc\u547d\u4ee4\u6ca1\u6709\u88ab\u5b89\u88c5\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e0b\uff0c\u90a3\u4e48\u7cfb\u7edf\u5c31\u65e0\u6cd5\u627e\u5230\u5b83\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u88ab\u4fee\u6539\u4e86\uff0c\u90a3\u4e48\u7cfb\u7edf\u5c31\u65e0\u6cd5\u627e\u5230cc\u547d\u4ee4\u3002\u5982\u679c\u8fd9\u4e2a\u5185\u6838\u6a21\u5757\u88ab\u5220\u9664\u6216\u8005\u5347\u7ea7\u4e86\uff0c\u5c31\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5185\u6838\uff0c\u4ee5\u4fbf\u8ba9\u7cfb\u7edf\u80fd\u591f\u6b63\u786e\u5730\u627e\u5230cc\u547d\u4ee4\u3002<\/p>\n","protected":false},"author":1,"featured_media":15171,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[23,395,150,534,493],"class_list":["post-15170","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge","tag-lxt","tag-lby","tag-hjbl","tag-bycx","tag-rlj"],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/15170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=15170"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/15170\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media\/15171"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=15170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=15170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=15170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}