{"id":377,"date":"2024-07-25T18:09:47","date_gmt":"2024-07-25T10:09:47","guid":{"rendered":"https:\/\/blog.kishere.cn\/?p=377"},"modified":"2024-07-25T18:10:02","modified_gmt":"2024-07-25T10:10:02","slug":"%e4%b8%8egcc%e7%bc%96%e8%af%91%e5%99%a8%e7%9a%84%e6%90%8f%e6%96%97%e5%8f%b2","status":"publish","type":"post","link":"https:\/\/blog.kishere.cn\/?p=377","title":{"rendered":"\u4e0eGCC\u7f16\u8bd1\u5668\u7684\u640f\u6597\u53f2"},"content":{"rendered":"<h2>\u7f16\u8bd1\u7684\u4e00\u4e9b\u539f\u7406<\/h2>\n<h3>\u6807\u51c6\u5e93\u6587\u4ef6\u8def\u5f84<\/h3>\n<p>\u5176\u5b9e\u5728linux\u4e0b\u53ef\u4ee5\u5f88\u5bb9\u6613\u770b\u51fa\u6765\u7f16\u8bd1\u8fc7\u7a0b\u548c\u6807\u51c6\u5e93\u7684\u539f\u7406\uff0c\u6807\u51c6\u5e93\u7684\u5934\u6587\u4ef6\u90fd\u5728<code>\/usr\/include\/c++\/<\/code>\u4e2d\uff0clinux\u7cfb\u7edf\u5934\u6587\u4ef6\u5728<code>\/usr\/include\/<\/code>\u4e0b\u3002<\/p>\n<p>\u800c\u6807\u51c6\u5e93\u3001\u7cfb\u7edf\u5e93\uff0c\u65e2\u7136\u53eb\u5e93\uff0c\u5b83\u5fc5\u7136\u4e5f\u662f\u6709\u5e93\u6587\u4ef6\u7684\uff0c\u4ed6\u4eec\u5728\uff1a<code>\/usr\/lib\/gcc\/<\/code>\u548c<code>\/lib\/<\/code>\u4e0b\u3002<\/p>\n<h3>\u4f7f\u7528\u6807\u51c6\u5e93<\/h3>\n<p><code>std<\/code>\u547d\u540d\u7a7a\u95f4\u4e0b\u7684\u5e93\u4e0d\u9700\u8981\u624b\u52a8\u6307\u5b9a\uff0c\u4f46\u662f\u5176\u4ed6\u7684\u4e00\u4e9b\u5e93\u662f\u9700\u8981\u6307\u5b9a\u7684\uff0c\u6bd4\u5982 <strong>\\<filesystem><\/strong>\uff0c\u5728C++11\u4e2d\u662f\u53ef\u4ee5\u4f7f\u7528\u7684\uff0c\u4f46\u662f\u5e76\u4e0d\u5728<code>std<\/code>\u547d\u540d\u7a7a\u95f4\u4e0b\uff0c\u5934\u6587\u4ef6\u5e94\u8be5\u662f <strong>&lt;experimental\/filesystem><\/strong>\u3002\u800c\u8981\u5728c++14\u4e2d\u4f7f\u7528filesystem\uff0c\u9700\u8981\u989d\u5916\u94fe\u63a5<strong>libstdc++fs.a<\/strong>\u3002<\/p>\n<p>\u4f46\u662f\u94fe\u63a5\u5e93\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4e0d\u80fd\u7b80\u5355\u7684\u589e\u52a0\u7f16\u8bd1\u53c2\u6570 <code>-lstdc++fs<\/code>\uff0c\u8fd9\u4f1a\u4f7f\u5f97\u53c2\u6570\u88ab\u6dfb\u52a0\u5230\u7f16\u8bd1\u8fc7\u7a0b\u800c\u4e0d\u662f\u94fe\u63a5\u8fc7\u7a0b\uff0c\u5e94\u8be5\u5728\u6784\u5efa\u5de5\u5177\u7684\u4ee3\u7801\u4e2d\uff08\u6bd4\u5982qmake\uff09\uff0c\u4f7f\u7528<code>LIBS += -lstdc++fs<\/code>\u7b49\u8bed\u53e5\u4f7f\u5f97\u53c2\u6570\u6dfb\u52a0\u5230\u94fe\u63a5\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7f16\u8bd1\u7684\u4e00\u4e9b\u539f\u7406 \u6807\u51c6\u5e93\u6587\u4ef6\u8def\u5f84 \u5176\u5b9e\u5728linux\u4e0b\u53ef\u4ee5\u5f88\u5bb9\u6613\u770b\u51fa\u6765\u7f16\u8bd1\u8fc7\u7a0b\u548c\u6807\u51c6\u5e93\u7684\u539f\u7406\uff0c\u6807\u51c6\u5e93\u7684\u5934\u6587\u4ef6\u90fd\u5728\/usr\/include\/c++\/\u4e2d\uff0clinux\u7cfb\u7edf\u5934\u6587\u4ef6\u5728\/usr\/include\/\u4e0b\u3002 \u800c\u6807\u51c6\u5e93\u3001\u7cfb\u7edf\u5e93\uff0c\u65e2\u7136\u53eb\u5e93\uff0c\u5b83\u5fc5\u7136\u4e5f\u662f\u6709\u5e93\u6587\u4ef6\u7684\uff0c\u4ed6\u4eec\u5728\uff1a\/usr\/lib\/gcc\/\u548c\/lib\/\u4e0b\u3002 \u4f7f\u7528\u6807\u51c6\u5e93 std\u547d\u540d\u7a7a\u95f4\u4e0b\u7684\u5e93\u4e0d\u9700\u8981\u624b\u52a8\u6307\u5b9a\uff0c\u4f46\u662f\u5176\u4ed6\u7684\u4e00\u4e9b\u5e93\u662f\u9700\u8981\u6307\u5b9a\u7684\uff0c\u6bd4\u5982 \\\uff0c\u5728C++11\u4e2d\u662f\u53ef\u4ee5\u4f7f\u7528\u7684\uff0c\u4f46\u662f\u5e76\u4e0d\u5728std\u547d\u540d\u7a7a\u95f4\u4e0b\uff0c\u5934\u6587\u4ef6\u5e94\u8be5\u662f &lt;experimental\/filesystem>\u3002\u800c\u8981\u5728c++14\u4e2d\u4f7f\u7528filesystem\uff0c\u9700\u8981\u989d\u5916\u94fe\u63a5libstdc++fs.a\u3002 \u4f46\u662f\u94fe\u63a5\u5e93\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4e0d\u80fd\u7b80\u5355\u7684\u589e\u52a0\u7f16\u8bd1\u53c2\u6570 -lstdc++fs\uff0c\u8fd9\u4f1a\u4f7f\u5f97\u53c2\u6570\u88ab\u6dfb\u52a0\u5230\u7f16\u8bd1\u8fc7\u7a0b\u800c\u4e0d\u662f\u94fe\u63a5\u8fc7\u7a0b\uff0c\u5e94\u8be5\u5728\u6784\u5efa\u5de5\u5177\u7684\u4ee3\u7801\u4e2d\uff08\u6bd4\u5982qmake\uff09\uff0c\u4f7f\u7528LIBS += -lstdc++fs\u7b49\u8bed\u53e5\u4f7f\u5f97\u53c2\u6570\u6dfb\u52a0\u5230\u94fe\u63a5\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"author":1,"featured_media":196,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts\/377"}],"collection":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377"}],"version-history":[{"count":1,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions"}],"predecessor-version":[{"id":378,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions\/378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=\/wp\/v2\/media\/196"}],"wp:attachment":[{"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kishere.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}