{"id":93209,"date":"2024-04-08T22:22:10","date_gmt":"2024-04-08T14:22:10","guid":{"rendered":"http:\/\/gulass.cn\/?p=93209"},"modified":"2024-04-08T22:22:10","modified_gmt":"2024-04-08T14:22:10","slug":"linux-boost","status":"publish","type":"post","link":"https:\/\/gulass.cn\/linux-boost.html","title":{"rendered":"Linux\u5e73\u53f0\u7684boost\u5b89\u88c5\u65b9\u6cd5"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nBoost\u5e93\u662f\u4e3aC++\u8bed\u8a00\u6807\u51c6\u5e93\u63d0\u4f9b\u6269\u5c55\u7684\u4e00\u4e9bC++\u7a0b\u5e8f\u5e93\u7684\u603b\u79f0\uff0c\u7531Boost\u793e\u533a\u7ec4\u7ec7\u5f00\u53d1\u3001\u7ef4\u62a4\u3002Boost\u5e93\u53ef\u4ee5\u4e0eC++\u6807\u51c6\u5e93\u5b8c\u7f8e\u5171\u540c\u5de5\u4f5c\uff0c\u5e76\u4e14\u4e3a\u5176\u63d0\u4f9b\u6269\u5c55\u529f\u80fd\u3002\u4eca\u5929\u5c31\u4ecb\u7ecd\u4e00\u4e0bLinux\u7684\u5b89\u88c5<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\u3001\u5b89\u88c5\u65b9\u6cd5<\/strong><\/div>\n

\u5b89\u88c5boost\u7684\u65f6\u5019\uff0c\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u6309\u5982\u4e0b\u6b65\u9aa4\u5b89\u88c5\uff1a<\/p>\n

wget http:\/\/sourceforge.net\/projects\/boost\/files\/boost\/1.54.0\/boost_1_54_0.tar.gz\r\ntar -xzvf boost_1_54_0.tar.gz\r\ncd boost_1_54_0\r\n.\/bootstrap.sh --prefix=\/usr\/local\r\n.\/b2 install --with=all\r\nboost\u5e93\u88ab\u5b89\u88c5\u5728\/usr\/local\/lib\u4e0b\u9762<\/pre>\n
\u4e8c\u3001\u7f16\u8bd1\u9519\u8bef<\/strong><\/div>\n

\u82e5\u7f16\u8bd1\u5e26\u6709boost\u5e93\u7684\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u5982\u5728\u7ec8\u7aef\u8fd0\u884c\u547d\u4ee4\uff1ag++ syslogem.cpp -lboost_system<\/p>\n

\u82e5\u51fa\u73b0\u5982\u4e0b\u9519\u8bef<\/p>\n

undefined reference to `boost::system::generic_category()'\r\nundefined reference to `boost::system::generic_category()'\r\nundefined reference to `boost::system::system_category()'<\/pre>\n

\u53ea\u597d\u6dfb\u52a0\u8def\u5f84<\/p>\n

g++ syslogem.cpp -L\/usr\/local\/lib -lboost_system\r\n<\/pre>\n

\u800c\u5728Linux\u7684eclipse\u5e73\u53f0\u4e0a\u7684\u89e3\u51b3\u529e\u6cd5\u662f\u6dfb\u52a0\"\/usr\/local\/lib\"\u8def\u5f84\u3002<\/p>\n

\"\"<\/p>\n

\u4e09\u3001\u8fd0\u884c\u9519\u8bef<\/strong><\/div>\n

\u82e5\u518d\u8fd0\u884c\u9636\u6bb5\u51fa\u73b0\u5982\u4e0b\u9519\u8bef<\/p>\n

error while loading shared libraries: libboost_system.so.1.54.0: cannot open shared object file: No such file or directory<\/pre>\n

\u5728\u53ef\u4ee5\u8fdb\u884c\u5982\u4e0b\u89e3\u51b3\uff1a<\/p>\n

 1)\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\uff1aLD_LIBRARY_PATH=\/usr\/local\/lib<\/pre>\n

\u5728eclipse\u7684\u6dfb\u52a0\u65b9\u5f0f\u662f\u70b9\u51fb\uff1a\u8fd0\u884c\/\u8fd0\u884c\u914d\u7f6e\/\u73af\u5883\/\u65b0\u5efa\u3002\u63a5\u7740\u6dfb\u52a0\u4e0a\u8ff0\u7684\u53d8\u91cf\u548c\u53d8\u91cf\u503c\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n

\"\"<\/p>\n

\u6ce8\u610f\uff1a<\/p>\n

\u82e5\u5e0c\u671b\u5728\u7ec8\u7aef\u4e0a\u6267\u884c\u547d\u4ee4\uff0c\u5219\u9700\u8981export\u5230~\/.bash_profile\u6587\u4ef6\u4e2d\u3002\u5f53\u7136\u82e5\u662f\u6dfb\u52a0\u5230\u4e86\u542f\u52a8\u6587\u4ef6\u540e\uff0c\u5c31\u4e0d\u9700\u5728eclipse\u4e2d\u8fdb\u884c\u914d\u7f6e\u4e86\u3002<\/p>\n

2)\u624b\u52a8\u6dfb\u52a0\u94fe\u63a5\uff1aln -s \/usr\/local\/lib\/libboost_system.so.1.54.0 \/lib64\r\n<\/pre>\n

\u8fd9\u4e2a\u9700\u8981\u5728Linux\u7ec8\u7aef\u8fdb\u884c\u64cd\u4f5c\uff0c\u4e0d\u7ba1\u662f\u5426\u4f7f\u7528\u4e86eclipse\u5e73\u53f0\u3002<\/p>\n

 <\/p>\n

\u56db\u3001eclipse \u6587\u4ef6\u76ee\u5f55\u7ba1\u7406<\/strong><\/div>\n

\u7531\u4e8e\u5728C++\u9879\u76ee\u4e2d\uff0c\u5b58\u5728\u5f88\u591a\u6587\u4ef6\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u5bf9\u8fd9\u4e9b\u6587\u4ef6\u7684\u7ba1\u7406\uff0c\u6240\u4ee5\u521b\u5efa\u4e86\u4e00\u4e9b\u6587\u4ef6\u5939\u5bf9\u5927\u91cf\u6587\u4ef6\u8fdb\u884c\u7ba1\u7406\u3002\u4f46\u8fd9\u6837\u5bfc\u81f4\u9879\u76ee\u4e2d\u7684\u5f15\u7528\u975e\u5e38\u590d\u6742\uff0c\u4ece\u800c\u53ef\u91c7\u7528\u5728\u9879\u76ee\u4e2d\u6dfb\u52a0\u81ea\u52a8\u641c\u7d22\u8def\u5f84\u6765\u89e3\u51b3\u5f15\u7528\u590d\u6742\u7684\u95ee\u9898\u3002\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

\u53f3\u51fb\u9879\u76ee\uff0c\u9009\u62e9\u5c5e\u6027\uff1b\r\n\u9009\u62e9\uff1aC\/C++\u6784\u5efa\u00e0\u8bbe\u7f6e\u00e0GNC C++ \u7f16\u8bd1\u5668\u00e0\u5305\u542b\uff1b\r\n\u5728\u4e0a\u90e8\u5206\u4e2d\uff0c\u6dfb\u52a0\u8def\u5f84\uff1b\r\n\u70b9\u51fb\u5de5\u4f5c\u7a7a\u95f4\uff0c\u6dfb\u52a0\u9700\u8981\u641c\u7d22\u7684\u76ee\u5f55\u3002<\/pre>\n

\"\"<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.cnblogs.com\/hlwfirst\/p\/5424033.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/gulass.cn\/linux-boost.html<\/a>\u7f16\u8f91\uff1a\u4efb\u7ef4\u56fd\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Boost\u5e93\u662f\u4e3aC++\u8bed\u8a00\u6807\u51c6\u5e93\u63d0\u4f9b\u6269\u5c55\u7684\u4e00\u4e9bC++\u7a0b\u5e8f\u5e93\u7684\u603b\u79f0\uff0c\u7531Boost\u793e\u533a\u7ec4\u7ec7\u5f00\u53d1\u3001\u7ef4\u62a4\u3002Boo […]<\/p>\n","protected":false},"author":63,"featured_media":93213,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-93209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/93209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=93209"}],"version-history":[{"count":2,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/93209\/revisions"}],"predecessor-version":[{"id":93248,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/93209\/revisions\/93248"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/93213"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=93209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=93209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=93209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}