{"id":3850,"date":"2020-10-04T23:00:00","date_gmt":"2020-10-04T15:00:00","guid":{"rendered":"http:\/\/benjenq.ddns.net\/blog\/%e3%80%90%e7%a2%bc%e8%be%b2%e3%80%91linux%ef%bc%88ubuntu%ef%bc%89%e7%92%b0%e5%a2%83%e9%96%8b%e7%99%bc-c-c-%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f\/"},"modified":"2020-10-04T23:00:00","modified_gmt":"2020-10-04T15:00:00","slug":"%e3%80%90%e7%a2%bc%e8%be%b2%e3%80%91linux%ef%bc%88ubuntu%ef%bc%89%e7%92%b0%e5%a2%83%e9%96%8b%e7%99%bc-c-c-%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f","status":"publish","type":"post","link":"http:\/\/benjenq.ddns.net\/blog\/%e3%80%90%e7%a2%bc%e8%be%b2%e3%80%91linux%ef%bc%88ubuntu%ef%bc%89%e7%92%b0%e5%a2%83%e9%96%8b%e7%99%bc-c-c-%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f\/","title":{"rendered":"\u3010\u78bc\u8fb2\u3011Linux\uff08Ubuntu\uff09\u74b0\u5883\u958b\u767c C\/C++ \u61c9\u7528\u7a0b\u5f0f"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"Eclipse_VSCode_C_CPP.png\" height=\"268\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602083111-2989106684-g.png\" title=\"Eclipse_VSCode_C_CPP.png\" width=\"640\"><\/p>\n<p>\u4e5d\u6708\u6642\u5de5\u4f5c\u4e0a\u63a5\u5230\u4e00\u9805\u4efb\u52d9\uff0c\u5167\u5bb9\u662f\u8a55\u4f30\u67d0\u786c\u9ad4\u65b9\u6848\u7684\u53ef\u80fd\u6027\u3002\u8a72\u786c\u9ad4\u8a2d\u5099\u5ee0\u5546\u6709\u63d0\u4f9b Windows \u8207 Linux \u5169\u7a2e\u65b9\u6848\u8b93\u5ba2\u6236\u9078\u64c7\uff0c\u70ba\u4e86\u8d95\u9032\u5ea6\uff0c\u6240\u4ee5\u76f4\u63a5\u4ee5\u719f\u6089\u7684 Windows \u65b9\u6848\u4f7f\u7528&nbsp;C# \u9032\u884c\u8a66\u4f5c\uff0c\u53ef\u60dc\u8a55\u4f30\u7d50\u679c\u4e0d\u76e1\u4eba\u610f\uff08\u786c\u9ad4\u554f\u984c\uff09\u3002\u7136\u800c\u5728\u6b64\u8a55\u4f30\u904e\u7a0b\u4e2d\uff0c\u4e5f\u8b93\u6211\u610f\u8b58\u5230&nbsp;Linux \u53ef\u80fd\u4e5f\u662f\u5546\u7528\u786c\u9ad4\u8a2d\u5099\u7684\u9078\u9805\u4e4b\u4e00\uff0c\u6240\u4ee5\u5728\u4e2d\u79cb\u7bc0\u9023\u5047\u671f\u9593\uff0c\u9664\u4e86\u5403\u98ef\u7761\u89ba\u62c9\u5c4e\u770b\u96fb\u8996\u6253\u96fb\u52d5\u901b\u8857\u4eba\u64e0\u4eba\u4e4b\u5916\uff0c\u628a\u5269\u4e0b\u7684\u6642\u9593\u5168\u90fd\u82b1\u5728\u5b78\u7fd2\u5efa\u7f6e\u300cLinux \u74b0\u5883\u958b\u767c C\/C++\u300d\u9019\u4ef6\u4e8b\u60c5\u4e0a\u4e86\u3002\u56db\u5929\u9023\u5047\u7d50\u675f\uff0c\u7b97\u662f\u6709\u9ede\u6536\u7372\uff0c\u958b\u7bc7\u6587\u7ae0\u628a\u9019\u4e9b\u5b78\u7fd2\u5fc3\u5f97\u8a18\u9304\u4e0b\u4f86\uff0c\u514d\u5f97\u4ee5\u5f8c\u5f88\u5feb\u53c8\u5fd8\u8a18\u3002<\/p>\n<p>\u9019\u7bc7\u6587\u7ae0\u4ee5\u300c\u5728 Linux \u74b0\u5883\u4e0b\u958b\u767c MQTT C\/C++ Client \u61c9\u7528\u7a0b\u5f0f\u300d\u70ba\u76ee\u6a19\u60c5\u5883\uff0c\u6253\u9020 Linux \u74b0\u5883\u4e0b\u76f8\u5c0d\u53cb\u5584\u7684 C\/C++ \u958b\u767c\u74b0\u5883\uff0c\u4f7f\u7528&nbsp;Linux \u7248 IDE \u5de5\u5177\u9032\u884c C\/C++ \u7a0b\u5f0f\u958b\u767c\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u70ba\u4f55\u8981\u4ee5\u300c\u958b\u767c MQTT C\/C++ Client\u300d\u4f5c\u70ba\u76ee\u6a19\u60c5\u5883\uff1f\u539f\u56e0\u662f\u727d\u6d89\u5230 IDE \u958b\u767c\u5de5\u5177\u4e2d\u5f15\u5165 Library \uff08\u51fd\u5f0f\u5eab\u5957\u4ef6\uff09\u7de8\u8b6f\u7684\u8a2d\u5b9a\u6307\u4ee4\uff0c\u5927\u90e8\u5206\u61c9\u7528\u8edf\u9ad4\u4e00\u5b9a\u662f\u9019\u9ebc\u505a\uff0c\u6240\u4ee5\u62ff MQTT C\/C++ Library \u4f5c\u70ba\u7bc4\u4f8b\u60c5\u5883\u3002\u5982\u679c\u53ea\u662f\u5728 Linux \u74b0\u5883\u4e0b\u7528 IDE&nbsp; \u5beb\u500b print Hello World \uff0c\u5c31\u4e0d\u7528\u7279\u610f\u5beb\u9019\u7bc7\u6587\u7ae0\u4f86\u8a18\u9304\u4e86\u3002<\/p>\n<p><span style=\"font-size:20px\"><strong>\u4e00\u3001\u6e96\u5099\u5de5\u4f5c<\/strong><\/span><\/p>\n<p>\u4e00\u53f0\u904b\u4f5c Ubuntu 18.04 \u4e26\u53ef\u9023\u7d50 Internet \u7684\u96fb\u8166\uff0c\u865b\u64ec\u6a5f\u5668\u4e5f\u884c\u3002\uff08<a href=\"https:\/\/www.ubuntu-tw.org\/modules\/tinyd0\/\" target=\"_blank\">Linux Ubuntu 18.04 \u4e0b\u8f09\u7db2\u5740<\/a>\uff09<\/p>\n<p><span style=\"font-size:20px\"><strong>\u4e8c\u3001\u57fa\u672c\u6280\u80fd<\/strong><\/span><\/p>\n<ul>\n<li>\u4f7f\u7528 IDE \u958b\u767c\u7a0b\u5f0f\u7684\u57fa\u672c\u7d93\u9a57<\/li>\n<li>Linux \u7d42\u7aef\u6a5f\u74b0\u5883\u57fa\u672c\u6307\u4ee4\u64cd\u4f5c<\/li>\n<\/ul>\n<p><span style=\"font-size:20px\"><strong>\u4e09\u3001\u8a2d\u7f6e Linux \u57fa\u672c\u958b\u767c\u74b0\u5883<\/strong><\/span><\/p>\n<p>\u672c\u6587\u4ee5 MQTT C\/C++ Client \u70ba\u4f8b\uff0c\u6240\u4ee5\u5148\u628a MQTT \u7684\u53ef\u904b\u4f5c\u74b0\u5883\u67b6\u8d77\u4f86\uff0c\u610f\u601d\u662f\u5728 Ubuntu \u96fb\u8166\u4e0a\u5b89\u88dd&nbsp;MQTT Broker \u5c31\u884c\u4e86\u3002\u5728\u5b89\u88dd MQTT Broker \u4e4b\u524d\uff0c\u8a18\u5f97\u8981\u7528\u7d42\u7aef\u6a5f\u8dd1\u4e00\u6b21\u5957\u4ef6\u66f4\u65b0\uff1a<\/p>\n<p>$&nbsp;sudo apt update &amp;&amp; sudo apt upgrade -y<\/p>\n<p><span style=\"font-size:16px\"><strong>3.1 \u5b89\u88dd Mosquitto MQTT Broker<\/strong><\/span><\/p>\n<p>Linux\uff08Ubuntu\uff09\u5b89\u88dd MQTT Broker \u8d85\u7c21\u55ae\uff01\u7d42\u7aef\u6a5f\u4e00\u884c\u6307\u4ee4\u641e\u5b9a\u3002<\/p>\n<p>$&nbsp;sudo apt install mosquitto mosquitto-clients -y<\/p>\n<p>\u7b49\u5b89\u88dd\u7a0b\u5e8f\u8dd1\u5b8c\u5c31\u53ef\u4ee5\u4e86\u3002\u53ef\u4ee5\u7528 service mosquitto status \u67e5\u770b MQTT Broker \u7684\u72c0\u614b\uff0c\u4eae\u7da0\u71c8\u5beb\u8457 <span style=\"color:#66cc00\"><strong><span style=\"background-color:#5E093A\">active (running)<\/span><\/strong><\/span> \u5c31\u4ee3\u8868\u904b\u4f5c\u4e2d\u3002<\/p>\n<p><img decoding=\"async\" alt=\"2020-10-05 00-03-05 \u7684\u87a2\u5e55\u64f7\u5716.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601827449-3718394468-g.png\" title=\"2020-10-05 00-03-05 \u7684\u87a2\u5e55\u64f7\u5716.png\"><\/p>\n<p>\u5982\u679c\u4e0d\u6b7b\u5fc3\u9084\u60f3\u6e2c\u8a66 MQTT \u662f\u5426\u80fd\u6b63\u5e38\u904b\u4f5c\uff0c\u53ef\u4ee5\u958b\u5169\u500b\u7d42\u7aef\u6a5f\u8996\u7a97\uff0c\u5404\u81ea\u8f38\u5165\u6307\u4ee4\u5c31\u884c\u4e86\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u622a\u5716 2020-10-05 \u4e0a\u534812.16.14.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601828204-1350156135-g.png\" title=\"\u622a\u5716 2020-10-05 \u4e0a\u534812.16.14.png\"><\/p>\n<p>\u4ee5\u4e0a\u5716\u4f86\u8aaa\uff0c\u4e0b\u65b9\u7684\u8996\u7a97\u767c\u51fa\u300cHello world \u6e2c\u8a66\u300d\u7684\u5167\u5bb9\uff0c\u4e0a\u9762\u7684\u8996\u7a97\u6709\u63a5\u6536\u5230\u3002<\/p>\n<p><strong><span style=\"font-size:16px\">3.2 \u5b89\u88dd&nbsp;Eclipse Paho MQTT C\/C++ Client Library<\/span><\/strong><\/p>\n<p>\u56b4\u683c\u4f86\u8aaa\u5f97\u5206\u6210\u5169\u500b\u90e8\u5206\uff1aC Library \u8207 C++ Library\uff0c\u4e0d\u904e Eclipse Paho \u7684 <a href=\"https:\/\/github.com\/eclipse\/paho.mqtt.cpp\" target=\"_blank\">MQTT C++ Client Library<\/a> \u53c8\u4f9d\u9644\u5728&nbsp;<a href=\"https:\/\/github.com\/eclipse\/paho.mqtt.c\" target=\"_blank\">MQTT C&nbsp;Client Library<\/a> \u4e0a\uff0c\u63db\u53e5\u8a71\u8aaa\u4e0d\u50c5\u5169\u500b\u90fd\u8981\u5b89\u88dd\uff0c\u800c\u4e14\u8981\u5148\u5b89\u88dd C Library \u518d\u5b89\u88dd C++ Library\u3002\u807d\u8d77\u6709\u9ede\u8907\u96dc\uff0c\u5176\u5be6<a href=\"https:\/\/github.com\/eclipse\/paho.mqtt.cpp\" target=\"_blank\">\u5b98\u65b9<\/a>\u4e5f\u5e6b\u6211\u5011\u628a\u5b89\u88dd C Library -&gt; \u5b89\u88dd C++ Library \u7684\u81ea\u52d5\u8173\u672c\u90fd\u505a\u597d\u4e86\uff0c\u8ddf\u8457\u4ee5\u4e0b\u6307\u4ee4\u64cd\u4f5c\u5373\u53ef\uff1a<\/p>\n<p>$ sudo apt install git build-essential gcc make cmake cmake-gui cmake-curses-gui libssl-dev doxygen graphviz libcppunit-dev -y<br \/>\n$ cd ~<br \/>\n$ git clone https:\/\/github.com\/eclipse\/paho.mqtt.cpp<br \/>\n$ cd paho.mqtt.cpp<br \/>\n$ .\/install_paho_mqtt_c.sh<br \/>\n$ cmake -Bbuild -H. -DPAHO_BUILD_DOCUMENTATION=TRUE -DPAHO_BUILD_SAMPLES=FALSE<br \/>\n$ sudo cmake &#8211;build build\/ &#8211;target install<br \/>\n$ sudo ldconfig<\/p>\n<p>\u6307\u4ee4\u770b\u8d77\u4f86\u6709\u9ede\u591a\uff0c\u4e0d\u904e\u6574\u500b\u505a\u5b8c\u4e5f\u5dee\u4e0d\u591a\u4e00\u5169\u5206\u9418\u800c\u5df2\u3002\u8dd1\u5b8c\u4e4b\u5f8c\uff0c\/usr\/local\/lib \u8207 \/usr\/local\/include \u5169\u500b\u76ee\u9304\u4e0b\u6703\u65b0\u589e\u4e00\u4e9b MQTT \u7528\u5230\u7684 Library \u4e8c\u9032\u4f4d\u6a94\u8207 .h \u6a19\u982d\u6a94\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u534812_50.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601830556-2548391730-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u534812_50.png\"><\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u534812_52.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601830570-2306095834-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u534812_52.png\"><\/p>\n<p>\u505a\u5230\u9019\u88e1\uff0cC\/C++ MQTT Client Library \u5957\u4ef6\u5c31\u5df2\u7d93\u5b89\u88dd\u8a2d\u7f6e\u5b8c\u6210\uff0c\u627e\u500b\u7bc4\u4f8b\u7a0b\u5f0f\u8a66\u8457\u7de8\u8b6f\u57f7\u884c\u770b\u770b\u3002\u4ee5&nbsp;~\/paho.mqtt.cpp\/src\/samples \u5e95\u4e0b\u7684 topic_publish.cpp \u7bc4\u4f8b\u7a0b\u5f0f\u70ba\u4f8b\uff1a<\/p>\n<p>$ cd ~\/paho.mqtt.cpp\/src\/samples<br \/>\n$ g++ -g -o topic_publish topic_publish.cpp -lpaho-mqttpp3 -lpaho-mqtt3cs -lpaho-mqtt3as -lstdc++<br \/>\n$ .\/topic_publish<\/p>\n<p><img decoding=\"async\" alt=\"2020-10-05 02-36-34 \u7684\u87a2\u5e55\u64f7\u5716.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601836655-437359697-g.png\" title=\"2020-10-05 02-36-34 \u7684\u87a2\u5e55\u64f7\u5716.png\"><\/p>\n<p>\u82e5\u7de8\u8b6f\u548c\u57f7\u884c\u90fd\u6c92\u51fa\u73fe\u932f\u8aa4\u8a0a\u606f\uff0c\u8868\u793a\u5df2\u7d93\u53ef\u4ee5\u5728\u9019\u500b\u74b0\u5883\u4e0b\u7528 C\/C++ \u64b0\u5beb\u8207\u7de8\u8b6f MQTT \u7684\u61c9\u7528\u7a0b\u5f0f\u4e86\u3002\u5728 -o xxxx \u5f8c\u9762\u7684\u4e00\u5927\u4e32\u53c3\u6578\uff0c\u5c31\u662f\u7de8\u8b6f\u6642\u9700\u5f15\u7528\u7684\u7a0b\u5f0f\u78bc\u6216 Library \u51fd\u5f0f\u5eab\u3002<\/p>\n<p>\u78ba\u8a8d Library \u5b89\u88dd\u8a2d\u7f6e\u5f88\u91cd\u8981\uff0c\u82e5\u6c92\u5f04\u597d\uff0c\u5f8c\u9762 IDE \u7684\u7de8\u8b6f\u8a2d\u7f6e\u4e5f\u6703\u8ddf\u8457\u51fa\u554f\u984c\u3002\u6240\u4ee5\u8981\u78ba\u8a8d\u4e0a\u9762\u7684\u52d5\u4f5c\u90fd\u6c92\u554f\u984c\u4e4b\u5f8c\uff0c\u5f8c\u9762\u5c0e\u5165 IDE \u7684\u52d5\u4f5c\u624d\u80fd\u7e7c\u7e8c\u3002<\/p>\n<p><strong><span style=\"font-size:20px\">\u56db\u3001C\/C++ \u7684 IDE \u5de5\u5177\u8a2d\u5b9a<\/span><\/strong><\/p>\n<p>\u63a5\u4e0b\u4f86\u7c21\u55ae\u4ecb\u7d39\u5169\u6b3e\u652f\u63f4&nbsp;Linux \u74b0\u5883\u7684 C\/C++ IDE \u958b\u767c\u5de5\u5177\uff1aEclipse \u516c\u53f8\u7684 Eclipse for C\/C++\uff0c\u4ee5\u53ca\u5fae\u8edf\u7684 Visual Studio Code\uff08\u7c21\u7a31 VSCode\uff09\u3002<\/p>\n<p>\u5169\u6b3e\u5de5\u5177\u90fd\u9700\u8981\u7d93\u904e\u82e5\u5e72\u8a2d\u5b9a\u624d\u80fd\u7528\u65bc\u958b\u767c C\/C++\uff0cEclipse \u8a2d\u5b9a\u76f8\u5c0d\u7c21\u55ae\u4f46\u4f7f\u7528\u4e0a\u4e0d\u76f4\u89ba\uff08\u4e0d\u597d\u7528\uff09\uff0c\u800c VSCode \u5247\u662f\u53cd\u904e\u4f86\uff0c\u8a2d\u5b9a\u8907\u96dc\u4f46\u5bb9\u6613\u4f7f\u7528\uff0c\u4e14\u63d0\u793a\u529f\u80fd\u5f37\u5927\u3002\u8981\u4f7f\u7528\u54ea\u4e00\u7a2e\u7aef\u770b\u500b\u4eba\u7fd2\u6163\u8207\u559c\u597d\u3002<\/p>\n<p>\u63a5\u4e0b\u4f86\u4ee5\u4e0a\u8ff0\u7684 topic_publish.cpp \u70ba\u4f8b\uff0c\u8aaa\u660e\u5982\u4f55\u628a\u73fe\u6210\u7684\u7a0b\u5f0f\u5c0e\u5165&nbsp;IDE \u9032\u884c\u958b\u767c\u64b0\u5beb\u8207\u9664\u932f\u3002<\/p>\n<p>\u9996\u5148\u5fc5\u9808\u5148\u628a topic_publish.cpp \u7a0b\u5f0f\u505a\u57fa\u672c\u7684\u300c\u5c08\u6848\u5316\u300d\uff0c\u4e5f\u5c31\u662f\u5148\u5efa\u7acb\u65b0\u76ee\u9304\uff0c\u5c07\u7a0b\u5f0f\u8907\u88fd\u5230\u65b0\u76ee\u9304\u4e4b\u5f8c\uff0c\u4e26\u5728\u8a72\u76ee\u9304\u5c07\u7de8\u8b6f\u6307\u4ee4\u505a\u6210 Makefile \u6587\u5b57\u6a94\u3002\u64cd\u4f5c\u65b9\u5f0f\uff1a<\/p>\n<p>(1) \u5c07&nbsp;topic_publish.cpp \u8907\u88fd\u5230 ~\/[\u65b0\u76ee\u9304]\/topic_publish.cpp \uff0c\u9019\u88cf\u65b0\u76ee\u9304\u540d\u7a31\u7528&nbsp;topic_publish\u3002<\/p>\n<p>(2) \u5728\u6b64\u76ee\u9304\u4e0b\u624b\u52d5\u5efa\u7acb Makefile \u8a2d\u5b9a\u6a94\uff08nano Makefile\uff09\uff0c\u5167\u5bb9\u5982\u4e0b<\/p>\n<p>all:<br \/>\n&nbsp; &nbsp; g++ -g -o topic_publish topic_publish.cpp -lpaho-mqttpp3 -lpaho-mqtt3cs -lpaho-mqtt3as -lstdc++<br \/>\nclean:<br \/>\n&nbsp; &nbsp; rm topic_publish<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07_11-53-03_\u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"146\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602042917-1560352129-g_l.png\" title=\"2020-10-07_11-53-03_\u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>\u8981\u5f37\u8abf\u7684\u662f\uff0c<span style=\"color:#FF0000\"><strong>\u6307\u4ee4\u7684\u524d\u9762\u8981\u7528 Tab \u9375\u800c\u975e\u7a7a\u767d\u9375<\/strong><\/span>\uff0c\u4e5f\u5c31\u662f g++ \u8207 rm \u7684\u524d\u9762\u662f Tab \u800c\u975e\u7a7a\u767d\uff0c\u9019\u9ede\u975e\u5e38\u91cd\u8981\uff01\u6700\u5f8c\u5b58\u6a94\u96e2\u958b\u3002<\/p>\n<p>\u63a5\u8457\u5728\u76ee\u9304\u4e0b\u57f7\u884c make \u6307\u4ee4\uff0c\u770b\u770b\u7de8\u8b6f\u6642\u6703\u4e0d\u6703\u4f9d\u7167 Makefile \u6307\u4ee4\u9032\u884c\u7de8\u8b6f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07 12-03-14 \u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"132\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602043420-1680078261-g_l.png\" title=\"2020-10-07 12-03-14 \u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>&nbsp;<\/p>\n<p>\u82e5\u6c92\u4ec0\u9ebc\u932f\u8aa4\u8a0a\u606f\uff0c\u8868\u793a&nbsp;topic_publish.cpp \u7a0b\u5f0f\u7684\u300c\u5c08\u6848\u5316\u300d\u5b8c\u6210\u3002\u63a5\u8457\u5c31\u80fd\u628a\u9019\u500b\u300c\u5c08\u6848\u300d\u5c0e\u5165 IDE \u5de5\u5177\u4e86\u3002<\/p>\n<p><strong><span style=\"font-size:16px\">4.1<\/span><\/strong><strong><span style=\"font-size:16px\">&nbsp;Eclipse<\/span><\/strong><\/p>\n<p><span style=\"font-size:13px\"><strong>4.1.1 \u4e0b\u8f09 Eclipse<\/strong><\/span><\/p>\n<p>Eclipse \u4e0b\u8f09\u7db2\u5740\uff1a<a href=\"https:\/\/www.eclipse.org\/downloads\/packages\/\" target=\"_blank\">https:\/\/www.eclipse.org\/downloads\/packages\/<\/a><\/p>\n<p>\u9078\u64c7\u300cEclipse IDE for C\/C++ Developers\u300d\u7684 Linux 64-bit \u7248\u4e0b\u8f09\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u53482_50.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601837514-2341322809-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u53482_50.png\"><\/p>\n<p>\u4e0b\u8f09\u6a94\u6848\u662f .tar.gz \u58d3\u7e2e\u6a94\uff0c\u76f4\u63a5\u9ede\u64ca\u5f8c\u6703\u958b\u555f\u58d3\u7e2e\u6a94\u7ba1\u7406\u54e1\uff0c\u628a\u58d3\u7e2e\u6a94\u5167\u7684 eclipse \u76ee\u9304\uff0c\u76f4\u63a5\u62d6\u66f3\u5c31\u884c\u4e86\uff08\u5efa\u8b70\u5b89\u88dd\u5728 [\u5bb6\u76ee\u9304] \uff0c\u5f8c\u7e8c\u6bd4\u8f03\u65b9\u4fbf\uff09\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u53482_56.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601838084-334933446-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u53482_56.png\"><\/p>\n<p>\u9032\u5165 eclipse \u4e4b\u5f8c\uff0c\u76f4\u63a5\u9ede\u64ca eclipse \u57f7\u884c\u6a94\u5c31\u53ef\u904b\u884c Eclipse\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u53483_03.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1601838342-223367456-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_5_\u4e0a\u53483_03.png\"><\/p>\n<p><span style=\"font-size:13px\"><strong>4.1.2 \u4f7f\u7528 Eclipse \u958b\u767c C\/C++<\/strong><\/span><\/p>\n<p>\u555f\u52d5\u904b\u884c&nbsp;Eclipse\uff0c\u7b2c\u4e00\u6b21\u57f7\u884c\u6703\u554f workspace \u7684\u76ee\u9304\uff0c\u4e0d\u505a\u4efb\u4f55\u66f4\u52d5\uff0c\u9ede\u64ca Launch<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07 11-43-23 \u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"393\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602042304-794456643-g.png?v=1602042305\" title=\"2020-10-07 11-43-23 \u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>\u9ede\u64ca\u300cImport a project with a working Makefile\u300d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07_11-57-49_\u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"483\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602043133-827977928-g.png\" title=\"2020-10-07_11-57-49_\u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>\u4f9d\u4e0b\u5716\u6b65\u9a5f 1. -&gt;2. -&gt;3. \uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07_12-04-54_\u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"573\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602043713-3662078435-g.png\" title=\"2020-10-07_12-04-54_\u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>\u9078\u64c7 ~\/topic_publish \u76ee\u9304\uff0c\u9ede\u64ca Linux GCC\uff0c\u6309 Fihish \u3002<\/p>\n<p>\u628a\u300cWelcome\u300d\u9801\u7c64\u95dc\u6389\uff0c\u7d42\u65bc\u9032\u5165 C\/C++ \u958b\u767c\u4ecb\u9762\u6a21\u5f0f\u3002<\/p>\n<p><img decoding=\"async\" alt=\"2020-10-07_12-13-36_\u7684\u87a2\u5e55\u64f7\u5716.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602044487-1321411662-g.png\" title=\"2020-10-07_12-13-36_\u7684\u87a2\u5e55\u64f7\u5716.png\"><\/p>\n<p>\u53ef\u4ee5\u770b\u5f97\u51fa\u958b\u767c\u4ecb\u9762\u7684\u529f\u80fd\u76f8\u7576\u5b8c\u6574\u4f46\u6709\u9ede\u8907\u96dc\uff0c\u4e0a\u5c31\u662f\u4e0a\u5716\u6a19\u793a\u51fa\u4f86\u7684\u90a3\u4e9b\u6bd4\u8f03\u91cd\u8981\uff0c\u7d30\u7bc0\u8acb\u81ea\u884c Google\u3002\u7136\u5f8c\u5373\u4f7f\u532f\u5165\u5c08\u6848\uff0c\u4ecd\u5c11\u4e86 Launch Configuration \u8a2d\u5b9a\u3002\uff08\u4e0a\u5716\u7d05\u6846\uff09\u3002<\/p>\n<p>\u7136\u5f8c\u91cd\u9ede\u4f86\u4e86&#8230;<span style=\"color:#FF0000\"><strong>\u5728\u5c08\u6848\u540d\u7a31\u4e0a\u6309\u53f3\u9375 &#8211;&gt; Build Project<\/strong><\/span>\u3002\u9019\u9ebc\u505a\u7684\u76ee\u7684\u662f\u5148\u8b93 Eclipse IDE \u8dd1\u4e00\u904d Makefile \u7684\u8a2d\u5b9a\u4e26\u81ea\u52d5\u5075\u6e2c\uff0c\u5426\u5247\u5f8c\u9762\u7121\u6cd5\u4f7f\u7528&nbsp;Launch Configuration \u8a2d\u5b9a\u7cbe\u9748\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u534812_31.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602045149-2545985924-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u534812_31.png\"><\/p>\n<p>\u63a5\u8457\u9ede\u64ca\u65b0\u589e&nbsp;Launch Configuration \u958b\u555f\u8a2d\u5b9a\u7cbe\u9748\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u534812_23.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602044628-921577929-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u534812_23.png\"><\/p>\n<p>\u6309 Next \uff0c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07_12-24-15_\u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"604\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602044702-801688938-g.png\" title=\"2020-10-07_12-24-15_\u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"554\"><\/p>\n<p>\u53ef\u8a2d\u5b9a Launch Configuration \u540d\u7a31\uff0c\u82e5\u4e0d\u8a2d\u5b9a\u76f4\u63a5\u6309 Finish \u5373\u53ef\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07_12-35-46_\u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"603\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602045447-444365574-g.png\" title=\"2020-10-07_12-35-46_\u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"602\"><\/p>\n<p>\u9019\u6a23\u5c31\u5927\u81f4\u8a2d\u5b9a\u5b8c\u6210\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07 12-42-08 \u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"539\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602045787-967619043-g.png\" title=\"2020-10-07 12-42-08 \u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>4.1.3 Eclipse \u7684\u4e00\u822c IDE \u529f\u80fd\uff1a<\/p>\n<p>\u652f\u63f4\u4e00\u822c IDE \u8a72\u6709\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u81ea\u52d5\u5b8c\u6210\uff08AutoComplete\uff09\uff0c\u986f\u793a\u5b9a\u7fa9\uff0c\u4ee5\u53ca Debug Break Point \u7b49\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u672a\u547d\u540d-1.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602046284-1356705895-g.png\" title=\"\u672a\u547d\u540d-1.png\"><\/p>\n<p>\u4e0a\u8ff0\u53ef\u4ee5\u767c\u73fe Eclipse \u63d0\u4f9b\u4e86\u7cbe\u9748\u5de5\u5177\uff0c\u5728\u57f7\u884c\u8a2d\u5b9a\u6b65\u9a5f\u6642\u591a\u534a\u662f\u6839\u64da\u6307\u793a\u4e0b\u4e00\u6b65\u5c31\u5b8c\u6210\u4e86\uff0c\u4f46\u7cbe\u9748\u8a2d\u5b9a\u9084\u662f\u4e0d\u5920\u89aa\u6c11\uff0c\u6709\u6642\u4e0d\u5c0f\u5fc3\u641e\u932f\u4e00\u500b\u52d5\u4f5c\uff0c\u5c31\u6703\u641e\u4e0d\u61c2\u70ba\u4f55\u6c92\u6709\u4e0b\u4e00\u6b65\u7684\u9078\u9805\u3002<\/p>\n<p><span style=\"font-size:16px\"><strong>4.2 \u5fae\u8edf Visual Studio Code\uff08VSCode\uff09<\/strong><\/span><\/p>\n<p>\u6211\u5728\u5148\u524d\u5beb\u904e VSCode \u64b0\u5beb <a href=\"https:\/\/benjenq.pixnet.net\/blog\/post\/47285865\" target=\"_blank\">python<\/a> \u8207 <a href=\"https:\/\/benjenq.pixnet.net\/blog\/post\/47287566\" target=\"_blank\">PHP<\/a> \u7684\u6587\u7ae0\uff0c\u8a2d\u5b9a\u4e0a\u96d6\u7136\u4e0d\u8907\u96dc\uff0c\u4f46\u9084\u662f\u6709\u4e9b\u5f88\u795e\u5947\u7684\u9a37\u64cd\u4f5c\u3002\u6c92\u60f3\u5230&nbsp;VSCode \u64b0\u5beb C\/C++ \u7684\u8a2d\u5b9a\u66f4\u662f\u5947\u8469\uff0c\u9a37\u64cd\u4f5c\u66f4\u591a\u3002<\/p>\n<p>\u4e0d\u904e\u641e\u5b9a\u9019\u4e9b\u9a37\u64cd\u4f5c\u4e4b\u5f8c\uff0c\u7528\u8d77\u4f86\u7684\u611f\u89ba\u771f\u7684\u5f88\u4e0d\u932f\uff0c\u9084\u6709\u4e00\u5927\u5806\u5916\u639b\u53ef\u6eff\u8db3\u500b\u4eba\u7279\u5b9a\u9700\u6c42\u3002\u6240\u4ee5\u6bd4\u8d77 Eclipse\uff0c\u6211\u500b\u4eba\u662f\u63a8\u85a6\u4f7f\u7528 VSCode \u4f86\u958b\u767c C\/C++\u3002<\/p>\n<p>\u5728\u6b64\u5148\u5f37\u8abf\u4e00\u500b\u89c0\u5ff5\uff1a\u7528 VSCode \u64b0\u5beb C\/C++ \u9700\u5148\u5728\u5c08\u6848\u6839\u76ee\u9304\u5e95\u4e0b\u7684&nbsp;.vscode \u5b50\u76ee\u9304\u5167\u5efa\u7acb\u4e09\u500b\u8a2d\u5b9a\u6a94\uff1ac_cpp_properties.json\uff0ctasks.json\uff0claunch.json\u3002\u4e0d\u904e\u627e\u4e86\u4e00\u5927\u5806\u7db2\u8def\u6559\u5b78\uff0c\u5168\u90fd\u6c92\u4ea4\u4ee3\u9019\u4e09\u500b\u6a94\u6848\u662f\u600e\u9ebc\u751f\u51fa\u4f86\u7684\uff0c\u683c\u5f0f\u8ddf\u9805\u76ee\u70ba\u4f55\u8981\u9577\u6210\u90a3\u6a23\u3002\u96d6\u7136\u6700\u7b28\u7684\u65b9\u5f0f\u96d6\u7136\u53ef\u4ee5\u624b\u52d5\u4e00\u500b\u5b57\u4e00\u500b\u5b57\u6572\u6253\u7522\u751f\uff0c\u4f46\u5b8c\u5168\u4e0d\u5efa\u8b70\u9019\u9ebc\u505a\u3002<\/p>\n<p>\u4e8b\u5be6\u4e0a\u53ef\u4ee5\u900f\u904e\u4e00\u5806\u9a37\u64cd\u4f5c\u751f\u6210\u4e09\u500b\u8a2d\u5b9a\u6a94\uff0c\u7522\u751f\u4e4b\u5f8c\u53ea\u9700\u91dd\u5c0d\u5c08\u6848\u7684\u7279\u6027\uff0c\u4fee\u6539\u5c40\u90e8\u5fae\u8abf\u5373\u53ef\uff0c\u504f\u504f\u7db2\u8def\u6559\u5b78\u5f88\u591a\u90fd\u662f\u6284\u4f86\u6284\u53bb\uff0c\u5168\u90fd\u6c92\u6709\u4ecb\u7d39\u5982\u4f55\u81ea\u52d5\u751f\u6210\uff08\u4e0d\u77e5\u662f\u5426\u56e0\u70ba\u4e0b\u932f\u95dc\u9375\u5b57\uff0c\u7e3d\u4e4b\u6211\u627e\u4e86\u5f88\u4e45\u6c92\u627e\u5230\uff09\uff0c\u6240\u4ee5\u5149\u662f C\/C++ \u7684\u8a2d\u5b9a\u6a94\u9a37\u64cd\u4f5c\u6211\u5c31\u5f0f\u4e86\u5c07\u8fd1\u4e00\u5929\uff0c\u7e3d\u7b97\u641e\u51fa\u8a2d\u5b9a\u6a94\u7684\u751f\u6210\u6d41\u7a0b\u3002<\/p>\n<p><span style=\"color:#FF0000\"><strong>\u4e09\u500b\u8a2d\u5b9a\u6a94\u7684\u751f\u6210\u9084\u6709\u9806\u5e8f\uff0c\u9806\u5e8f\u932f\u4e86\u751f\u6210\u7684\u5167\u5bb9\u4e5f\u6703\u8ddf\u8457\u932f<\/strong><\/span>\uff0c\u5927\u5bb6\u90fd\u8aaa\u300cVisual Studio\u300d \u662f\u5730\u8868\u6700\u795e\u7684&nbsp;IDE \u5de5\u5177\uff0c\u4f46\u70ba\u4f55\u591a\u4e00\u500b Code \u5b57\uff0c\u5c31\u5f97\u641e\u5f97\u5982\u6b64\u6298\u9a30\u4eba\u751f\u5462\uff1f\u5fae\u8edf\u554a\u5fae\u8edf\uff0c\u6211\u771f\u7684\u662f\u641e\u4e0d\u61c2\u4f60&#8230;.<\/p>\n<p>\u597d\u4e86\uff0c\u7262\u9a37\u767c\u5b8c\uff0c\u9032\u5165\u6b63\u984c\u3002<\/p>\n<p><span style=\"font-size:13px\"><strong>4.2.1 \u4e0b\u8f09\u4e26\u5b89\u88dd\uff1a<a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\">\u4e0b\u8f09\u7db2\u5740<\/a>\uff0c\u9078 .deb \u7248\u5373\u53ef\u3002<\/strong><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716_2020-10-07_\u4e0b\u53481_09_40.png\" height=\"392\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602047552-2274208275-g.png\" title=\"\u622a\u5716_2020-10-07_\u4e0b\u53481_09_40.png\" width=\"640\"><\/p>\n<p>&nbsp;\u4e0b\u8f09\u5f8c\u76f4\u63a5\u9ede\u64ca .deb \u6a94\u9032\u884c\u5b89\u88dd\uff0c\u4f9d\u7167\u756b\u9762\u6307\u793a\u9032\u884c\u5b89\u88dd\u5373\u53ef\u3002\u5b89\u88dd\u5b8c\u6210\u4e4b\u5f8c\uff0c\u61c9\u7528\u7a0b\u5f0f\u5217\u8868\u5c31\u6703\u51fa\u73fe\u719f\u6089\u7684 Visudl Studio Code \u5716\u793a\u3002\u5728\u7d42\u7aef\u6a5f\u5167\u8f38\u5165\u300ccode\u300d\u4e5f\u80fd\u555f\u52d5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716_2020-10-07_\u4e0b\u53485_21_07.png\" height=\"622\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602062618-762517398-g.png\" title=\"\u622a\u5716_2020-10-07_\u4e0b\u53485_21_07.png\" width=\"640\"><\/p>\n<p><strong><span style=\"font-size:13px\">4.2.2 \u4f7f\u7528 Visual Studio Code \u9032\u884c C\/C++ \u958b\u767c<\/span><\/strong><\/p>\n<p>(1)\u958b\u555f\u7d42\u7aef\u6a5f\uff0c\u9032\u5165\u5c08\u6848\u76ee\u9304&nbsp;~\/topic_publish\uff0c\u5728\u8a72\u76ee\u9304\u5e95\u4e0b\u57f7\u884c\u6307\u4ee4\u300ccode .\u300d\uff08\u6ce8\u610f code \u5f8c\u9762\u6709\u500b\u300c\u9ede\u300d\u865f\uff09<\/p>\n<p>$ cd ~\/topic_publish<br \/>\n$ code .<\/p>\n<p>\u63a5\u8457\u5c31\u6703\u958b\u555f VSCode \u4e26\u81ea\u52d5\u5c07 topic_publish \u5c08\u6848\u5c0e\u5165\u3002\u4ee5\u4e0b\u662f\u4ecb\u9762\u6982\u8ff0\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"2020-10-07_17-27-29_\u7684\u87a2\u5e55\u64f7\u5716.png\" height=\"589\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602063199-663000238-g.png\" title=\"2020-10-07_17-27-29_\u7684\u87a2\u5e55\u64f7\u5716.png\" width=\"640\"><\/p>\n<p>\u4e3b\u52d5\u63d0\u793a\u5340\u7684\u529f\u80fd\u5f88\u597d\u7528\uff0c\u6703\u81ea\u52d5\u9810\u6e2c\u4f60\u73fe\u5728\u53ef\u80fd\u60f3\u505a\u4ec0\u9ebc\u800c\u4f5c\u51fa\u63d0\u793a\uff0c\u4f8b\u5982\u6709\u6642\u6703\u5efa\u8b70\u4f60\u53ef\u80fd\u9047\u5230\u4ec0\u9ebc\u554f\u984c\uff0c\u5b89\u88dd\u4ec0\u9ebc\u63d2\u4ef6\u6216\u505a\u4ec0\u9ebc\u64cd\u4f5c\u53ef\u4ee5\u89e3\u6c7a\u3002\u7576\u7136\u4e86\uff0c\u5982\u679c\u9810\u6e2c\u4e0d\u662f\u60f3\u8981\u7684\uff0c\u53ef\u4ee5\u9ede\u64ca X \u4e0d\u7406\u5b83\u3002\u9019\u88e1\u5c31\u4e0d\u63d0\u4e3b\u52d5\u63d0\u793a\u5340\u7684\u529f\u80fd\u4e86\u3002<\/p>\n<p>\u7b2c\u4e00\u4ef6\u4e8b\uff0c\u5c31\u662f\u5b89\u88dd\u9700\u8981\u7684\u63d2\u4ef6\uff0c\u9ede\u64ca\u63d2\u4ef6\u5e02\u96c6\u6309\u9215\uff0c\u5b89\u88dd\u4ee5\u4e0b\u4e94\u500b\u63d2\u4ef6\uff1a<\/p>\n<ul>\n<li><s>Bracket Pair Colorizer\uff1a\u4e0d\u540c\u62ec\u865f\u5c64\u7d1a\u986f\u793a\u4e0d\u540c\u62ec\u865f\u984f\u8272<\/s>\uff08\u5df2\u5167\u5efa\u65bc Visual Studio Code\uff09<\/li>\n<li>C\/C++ for Visual Studio Code\uff1a\u5fae\u8edf\u81ea\u5e36\u7684C\/C++\u5916\u639b\u3002<\/li>\n<li>C\/C++ Clang Command Adapter\uff1a\u63d0\u4f9b\u975c\u614b\u6aa2\u6e2c\uff08Lint\uff09<\/li>\n<li>C++ Intellisense\uff1a\u4e00\u7d44\u529f\u80fd\u7684\u540d\u7a31\uff0c\u9019\u4e9b\u529f\u80fd\u53ef\u8b93\u64b0\u5beb\u7a0b\u5f0f\u78bc\u8b8a\u5f97\u66f4\u65b9\u4fbf\u3002<\/li>\n<li>Include Autocomplete\uff1a\u63d0\u4f9b\u6a19\u982d\u6a94\u6848\u540d\u5b57\u7684\u88dc\u5168\u3002<\/li>\n<\/ul>\n<p>\u5176\u4ed6\u63d2\u4ef6\u53c3\u8003<\/p>\n<ul>\n<li>C\/C++ Snippets\uff1a\u81ea\u52d5\u63d2\u5165\u7a0b\u5f0f\u78bc\u7247\u6bb5\u3002<\/li>\n<li>C++ Helper\uff1a\u63d0\u4f9b\u64b0\u5beb C++ \u7a0b\u5f0f\u6642\u4e00\u4e9b\u597d\u7528\u7684\u5feb\u901f\u529f\u80fd\u3002<\/li>\n<li><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=cschlosser.doxdocgen\" target=\"_blank\">Doxygen Documentation Generator<\/a>\uff1a\u7522\u751f\u7a0b\u5f0f\u78bc\u8aaa\u660e\u8a3b\u89e3\u7684\u597d\u6771\u897f\u3002<\/li>\n<li>theme-chromodynamics\uff1a\u719f\u6089\u7684\u4f48\u666f\u4e3b\u984c\u3002<\/li>\n<li>Chinese (Traditional) Language Pack for Visual Studio Code\uff1a\u4ecb\u9762\u4e2d\u6587\u5316\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" alt=\"\u622a\u5716 2020-10-18 \u4e0a\u534810.11.19.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602987137-355341020-g.png\" title=\"\u622a\u5716 2020-10-18 \u4e0a\u534810.11.19.png\"><\/p>\n<p><span style=\"font-size:13px\"><strong>4.2.3 \u4f9d\u5e8f\u7522\u751f\u4e09\u500b\u8a2d\u5b9a\u6a94<\/strong><\/span><\/p>\n<p>\u4e09\u500b\u8a2d\u5b9a\u6a94\u4f9d\u5e8f\u70ba<\/p>\n<ol>\n<li>c_cpp_properties.json<\/li>\n<li>tasks.json<\/li>\n<li>launch.json<\/li>\n<\/ol>\n<p>\u4e09\u500b\u8a2d\u5b9a\u6a94\u90fd\u5728\u5c08\u6848\u76ee\u9304\u7684 .vscode \u5b50\u76ee\u9304\u4e0b\u3002\u4e0a\u9762\u63d0\u5230\u4e09\u500b\u8a2d\u5b9a\u6a94\u4e5f\u5fc5\u9808\u4f9d\u7167\u9806\u5e8f\u751f\u6210\uff0c\u63a5\u4e0b\u4f86\u5c31\u662f\u9032\u5165\u9023\u7e8c\u9a37\u64cd\u4f5c\u7684\u6b65\u9a5f\uff0c<span style=\"color:#FF0000\"><strong>\u6240\u6709\u7684\u64cd\u4f5c\u90fd\u6709\u500b\u91cd\u9ede\uff1a\u628a\u7de8\u8f2f\u5340\u8996\u7a97\u505c\u7559\u5728 .cpp \u4e3b\u6a94\u6848\u4e0a\uff0c\u518d\u9032\u884c\u76f8\u95dc\u64cd\u4f5c\u3002<\/strong><\/span><\/p>\n<p>(1) \u751f\u6210\u7b2c\u4e00\u500b\u8a2d\u5b9a\u6a94\uff1ac_cpp_properties.json\u3002<\/p>\n<p>\u4f9d\u4e0b\u5716 1. -&gt; 2. -&gt; 3. -&gt; 4.<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_03.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602065092-709151975-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_03.png\"><\/p>\n<p>\u63a5\u8457\u51fa\u73fe\u547d\u4ee4\u6846\uff0c\u9078\u64c7\u300cC\/C++:Edit Configurations (UI)\u300d\uff08\u6216\u662f\u300cC\/C++:Edit Configurations (JSON) \u4e5f\u53ef\u4ee5\u300d\u3002&nbsp;<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_06.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602065198-507080196-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_06.png\"><\/p>\n<p>\u51fa\u73fe\u9078\u9805\u5f0f\u7684\u4ecb\u9762\uff0c\u539f\u5247\u4e0a\u90fd\u4e0d\u9700\u8981\u66f4\u52d5\u4efb\u4f55\u8a2d\u5b9a\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_08.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602065311-1255850636-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_08.png\"><\/p>\n<p>\u5c07\u300cC\/C++ Configuration\u300d\u9801\u7c64\u95dc\u9589\u3002\u7136\u5f8c\u5c31\u53ef\u4ee5\u770b\u5230\u5728 .vscode \u76ee\u9304\u4e0b\u81ea\u52d5\u7522\u751f\u7b2c\u4e00\u500b\u8a2d\u5b9a\u6a94\u300cc_cpp_properties.json\u300d\u3002\u53ef\u4ee5\u900f\u904e\u4e0b\u5716\u7684 1. -&gt; 2. \u67e5\u770b\uff0c\u539f\u5247\u4e0a\u4e0d\u9700\u4efb\u4f55\u66f4\u52d5\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_11.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602065587-514508601-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_11.png\"><\/p>\n<p><span style=\"color:#FF0000\"><strong>\u7136\u5f8c\u5fc5\u9808\u518d\u56de\u5230\u9ede\u64ca .cpp \u4e0a\uff0c\u5426\u5247\u5f8c\u9762\u7684\u751f\u6210\u52d5\u4f5c\u6703\u51fa\u932f\u3002<\/strong><\/span><\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_18.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602065942-2357650684-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_18.png\"><\/p>\n<p>(2) \u63a5\u8457\u7e7c\u7e8c\u751f\u6210\u7b2c\u4e8c\u500b\u8a2d\u5b9a\u6a94\uff1atasks.json\u3002<\/p>\n<p>\u5728\u56de\u5230 .cpp \u7684\u524d\u63d0\u4e0b\uff0c\u4f9d\u4e0b\u5716\u9ede\u64ca 1. Terminal -&gt; 2. Configure Default Task&#8230;<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_21.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602066135-2882813706-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_21.png\"><\/p>\n<p>\u6703\u958b\u555f\u9078\u64c7\u8996\u7a97\u3002\u610f\u601d\u662f\u9078\u64c7\u4e0d\u540c\u7684\u7de8\u8b6f\u5668\uff0c\u57fa\u672c\u4e0a\u9078\u64c7\u54ea\u4e00\u500b\u90fd\u53ef\u4ee5\uff0c\u6211\u9078\u64c7 gcc \u9019\u4e00\u9805\u3002\u7b2c\u4e8c\u500b\u8a2d\u5b9a\u6a94 tasks.json \u4e5f\u6703\u81ea\u52d5\u751f\u6210\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_24.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602066303-1029981601-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_24.png\"><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_26.png\" height=\"525\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602066485-2038850848-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_26.png\" width=\"640\"><\/p>\n<p>\u4e0d\u904e tasks.json \u5167\u7684 args \u53c3\u6578\u5fc5\u9808\u624b\u52d5\u4fee\u6b63\uff0c\u539f\u56e0\u662f topic_publish.cpp \u5fc5\u9808\u5f15\u7528 MQTT C++ Client \u7684\u53c3\u6578\u624d\u80fd\u6b63\u5e38\u7de8\u8b6f\u3002\u53c3\u8003 Makefile \u5167\u5bb9\uff0c\u52a0\u5165\u4e00\u4e9b\u7de8\u8b6f\u53c3\u6578\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_33.png\" height=\"550\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602066926-843941829-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_33.png\" width=\"640\"><\/p>\n<p>\u7b2c\u4e8c\u500b tasks.json \u4e5f\u5b8c\u6210\u4e86\u3002<span style=\"color:#FF0000\"><strong>\u52d9\u5fc5\u518d\u628a\u8996\u7a97\u5207\u56de\u5230 topic_publish.cpp\u3002<\/strong><\/span><\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_38.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602067167-225924323-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_38.png\"><\/p>\n<p>(3) \u63a5\u4e0b\u4f86\uff0c\u751f\u6210\u7b2c\u4e09\u500b\u8a2d\u5b9a\u6a94\uff1alaunch.json\u3002<\/p>\n<p>\u4f9d\u4e0b\u5716\u9ede\u64ca 1.Run -&gt; 2. Open Confighration<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_40.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602067291-1473989737-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_40.png\"><\/p>\n<p>\u8df3\u51fa\u9078\u64c7\u9805\u76ee\uff0c\u9078\u64c7\u300cC++ (GDB\/LLDB\u300d<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_42.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602067407-1030770488-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_42.png\"><\/p>\n<p>\u53c8\u4e00\u5c64\u9078\u64c7\u8996\u7a97\uff0c\u539f\u5247\u4e0a\u9078\u54ea\u4e00\u500b\u90fd\u4e00\u6a23\u3002\u7531\u65bc\u524d\u9762\u5df2\u7d93\u9078\u64c7\u4e86 gcc\uff0c\u9019\u88cf\u4e5f\u4e00\u6a23\u9078\u64c7 gcc \u9805\u76ee<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_46.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602067610-3369718291-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_46.png\"><\/p>\n<p>\u7b2c\u4e09\u500b\u8a2d\u5b9a launch.json \u4e5f\u6703\u81ea\u52d5\u751f\u6210\uff0c\u4e26\u4e14 VSCode \u6703\u9806\u4fbf\u81ea\u52d5\u8dd1\u4e00\u4e0b\u76f8\u95dc\u8a2d\u5b9a\uff0c\u4e5f\u6703\u81ea\u52d5\u5207\u63db\u5230\u9664\u932f\u6a21\u5f0f\u3002\u6b63\u5e38\u7684\u8a71\u5207\u4e0b\u65b9\u63db\u5230 TERMINAL \u8996\u7a97\uff08\u5982\u4e0b\u5716\uff09\u53ef\u4ee5\u770b\u5230\u7a0b\u5f0f\u7de8\u8b6f\u5b8c\u6210\u4e5f\u8dd1\u904e\u4e00\u904d\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_49.png\" height=\"513\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602067808-1873547843-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_49.png\" width=\"640\"><\/p>\n<p>\u9019\u6a23\u5c31\u5927\u81f4\u5b8c\u6210\u5c08\u6848\u7684\u8a2d\u5b9a\u4e86\u3002\u4f9d\u4e0a\u8ff0\u7684\u64cd\u64cd\u4f5c\uff0c\u53ea\u9700\u8981\u4fee\u6539 tasks.json \u7684 args \u9805\u76ee\uff0c\u52a0\u5165\u5fc5\u8981\u7684 Library \u800c\u5df2\uff0c\u5176\u4ed6\u90fd\u4e0d\u7528\u7279\u5225\u66f4\u52d5\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_55.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602068142-809300305-g.png\" title=\"\u8cbc\u4e0a\u7684\u5f71\u50cf_2020_10_7_\u4e0b\u53486_55.png\"><\/p>\n<p>4.2.4 Visual Studio Code \u958b\u767c C\/C++ \u7684\u4e00\u822c IDE \u529f\u80fd\uff1a<\/p>\n<p>\u652f\u63f4\u4e00\u822c IDE \u8a72\u6709\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u81ea\u52d5\u5b8c\u6210\uff08AutoComplete\uff09\uff0c\u986f\u793a\u5b9a\u7fa9\uff0c\u4ee5\u53ca Debug Break Point \u3001\u986f\u793a\u8b8a\u6578\u503c\u7b49\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u672a\u547d\u540d-1.png\" height=\"718\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1602069031-517104861-g.png\" title=\"\u672a\u547d\u540d-1.png\" width=\"640\"><\/p>\n<p><span style=\"font-size:20px\"><strong>\u4e94\u3001\u5f8c\u8a18<\/strong><\/span><\/p>\n<p>\u4ee5\u4e0a\u53ea\u662f\u77ed\u77ed\u56db\u5929\u7684\u500b\u4eba\u5b78\u7fd2\u5fc3\u5f97\uff0c\u4e5f\u53ea\u7b97\u662f IDE for C\/C++ \u8a2d\u5b9a\u7684\u6700.\u6700.\u6700&#8230;.\u6700\u521d\u6b65\u5165\u9580\u800c\u5df2\uff0cIDE for C\/C++ \u771f\u6b63\u7684\u7528\u6cd5\u61c9\u8a72\u4e0d\u53ea\u6709\u9019\u6a23\uff0c\u50cf\u662f CMake \u9019\u985e\u9032\u968e\u7684\u7528\u6cd5\u3002\u54ea\u5929\u6709\u7814\u7a76\u51fa\u66f4\u597d\u7528\u7684\u65b9\u5f0f\uff0c\u6703\u518d\u56de\u982d\u904e\u4f86\u88dc\u5b8c\u9019\u7bc7\u6587\u7ae0\u3002&nbsp;<\/p>\n<p>\uff082020.10.25 \u88dc\u5145\uff09\u7d93\u904e\u4e00\u6bb5\u6642\u9593\u7684\u6478\u7d22\uff0c\u900f\u904e\u4f7f\u7528 VSCode \u627e\u5230\u66f4\u7c21\u55ae\u7684\u8a2d\u5b9a\u65b9\u5f0f\u3002\u4f7f\u7528\u4e00\u500b\u53eb\u300cFenix\u300d\u7684\u5ef6\u4f38\u63d2\u4ef6\u5c31\u884c\u4e86\u3002\u900f\u904e\u9019\u500b\u63d2\u4ef6\uff0c\u53ef\u4ee5\u5f88\u8f15\u9b06\u7684\u7522\u751f C++ \u5c08\u6848\u8a2d\u5b9a\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_29_25.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603589442-1771289493-g.png\" title=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_29_25.png\"><\/p>\n<p>\u9996\u5148\u5148\u7528 MSCode \u958b\u555f\u4e00\u500b\u65b0\u7684\u7a7a\u767d\u7684\u76ee\u9304\uff0c\u6211\u5011\u5c07\u5728\u9019\u500b\u76ee\u9304\u7522\u751f\u65b0\u7684 C++ \u5c08\u6848\u3002\u5728 Fenix \u5b89\u88dd\u555f\u7528\u4e4b\u5f8c\uff0c\u5de6\u908a\u6703\u51fa\u73fe\u65b0\u7684\u5716\u793a\u3002\u4f9d\u4e0b\u5716\u7684\u9806\u5e8f\u6307\u793a\u9ede\u64ca\uff1a1. \u5716\u793a -&gt; 2. Easy C++ Projects -&gt; 3. +\u865f -&gt; 4. Open Fenix<\/p>\n<p><img decoding=\"async\" alt=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_34_56.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603589854-2308185570-g.png\" title=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_34_56.png\"><\/p>\n<p>\u63a5\u8457\u6703\u51fa\u73fe Fenix \u7684\u4e3b\u756b\u9762\uff0c\u518d\u4f9d\u5e8f\u9ede\u64ca 5.Language C++ -&gt; 6. [G++\/GDB] -&gt; 7. Create<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_42_38.png\" height=\"329\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603590396-3722228657-g_l.png\" title=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_42_38.png\" width=\"640\"><\/p>\n<p>\u5207\u56de\u5c08\u6848\u7684\u6a94\u6848\u7e3d\u7ba1\uff08\u4e0b\u5716\u5de6\u908a\u7d05\u6846\u5716\u793a\uff09\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u7522\u751f\u4e00\u500b\u6700\u57fa\u672c\u7684 C++ \u5c08\u6848\u4e86\u3002\u5b83\u5df2\u7d93\u5e6b\u4f60\u628a Makefile \u548c VSCode \u6700\u91cd\u8981\u7684\u5169\u500b\u8a2d\u5b9a\uff1atasks.json \u8207 launch.json \u90fd\u5f04\u597d\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_52_54.png\" height=\"275\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603590860-2966123655-g.png\" title=\"\u622a\u5716_2020-10-25_\u4e0a\u53489_52_54.png\" width=\"640\"><\/p>\n<p>\u6700\u8fd1\u7814\u7a76\u5728\u7814\u7a76 Makefile \u7684\u64b0\u5beb\uff0c\u8aaa\u771f\u7684 Makefile \u4e5f\u662f\u4e00\u9580\u6df1\u5967\u7684\u5b78\u554f\uff0c<a href=\"https:\/\/mropengate.blogspot.com\/2018\/01\/makefile.html\" target=\"_blank\">\u7db2\u8def\u6559\u5b78<\/a>\u4e5f\u4e0d\u5c11\u3002\u9019\u500b\u81ea\u52d5\u7522\u751f\u7684 Makefile \u5167\u5bb9\u9577\u9019\u6a23\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716 2020-10-25 \u4e0a\u534810.03.06.png\" height=\"385\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603591447-2486870846-g.png\" title=\"\u622a\u5716 2020-10-25 \u4e0a\u534810.03.06.png\" width=\"640\"><\/p>\n<p>\u4e0d\u904e\u5f8c\u4f86\u6211\u5728\u7df4\u7fd2\u64b0\u5beb\u6642\uff0c\u767c\u73fe\u9019\u500b Makefile \u662f\u6709\u554f\u984c\u7684\u3002\u5728\u9810\u8a2d\u7522\u751f Makefile \u5167\u5bb9\u7684\u7b2c 20 \u884c\uff0c\u5fc5\u9808\u8981\u6539\u6210\u9019\u6a23\uff1a<\/p>\n<p>$(CXX) -I$(INCLUDE) -L$(LIB) $^ -o $@ $(LIBRARIES) <span style=\"color:#D1C742\"><strong><span style=\"background-color:#333333\">$(CXX_FLAGS)<\/span><\/strong><\/span><\/p>\n<p><img decoding=\"async\" alt=\"\u622a\u5716 2020-10-25 \u4e0a\u534810.08.19.png\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603591798-1329616279-g.png\" title=\"\u622a\u5716 2020-10-25 \u4e0a\u534810.08.19.png\"><\/p>\n<p>\u4e5f\u5c31\u662f\u8981\u5c07&nbsp;<span style=\"color:#D1C742\"><strong><span style=\"background-color:#333333\">$(CXX_FLAGS)<\/span><\/strong><\/span> \u79fb\u5230\u6700\u53f3\u908a\uff0c\u5f8c\u7e8c\u5728\u4f7f\u7528\u6642\u624d\u4e0d\u6703\u6709\u554f\u984c\u3002<\/p>\n<p><span style=\"font-size:20px\"><strong>\u516d\u3001\u521d\u6b65\u6210\u679c<\/strong><\/span><\/p>\n<p>\u7d93\u904e\u591a\u65e5\u7684\u7df4\u7fd2\uff0c\u6211\u505a\u4e86\u4e00\u500b&nbsp;C++ \u5c08\u6848\u653e\u5728 Github \u4e0a\uff08<a href=\"https:\/\/github.com\/benjenq\/BeMqttSample\" target=\"_blank\">BeMqttSample<\/a>\uff09\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716 2020-10-25 \u4e0a\u534810.16.40.png\" height=\"284\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603592269-274426317-g.png\" title=\"\u622a\u5716 2020-10-25 \u4e0a\u534810.16.40.png\" width=\"634\"><\/p>\n<p>\u5c08\u6848\u7684\u76ee\u7684\u662f\u4f7f\u7528 paho.mqtt.cpp \u53e6\u5916\u518d\u64b0\u5beb\u4e86\u81ea\u8a02 class \u985e\u5225 BeMqttClient\uff0c\u8b93 MQTT Client \u66f4\u76f4\u89ba\u3001\u7c21\u55ae\uff0c\u5bb9\u6613\u4f7f\u7528\uff0c\u6700\u77ed\u53ea\u9700\u4e09\u884c\u5ba3\u544a\u5c31\u80fd\u9a45\u52d5 MQTT&nbsp;Client \u904b\u884c\u3002\u9019\u500b\u5c08\u6848\u5c31\u662f\u7528\u9019\u7bc7\u6587\u7ae0\u63d0\u5230\u7684\u5167\u5bb9\uff08paho.mqtt.c\/cpp Client library\uff0cMakefile\uff0cMicrosoft Visual Studio Code&#8230;\uff09\uff0c\u4e00\u6b65\u4e00\u6b65\u6162\u6162\u515c\u51fa\u4f86\u7684\u3002<\/p>\n<p>\u4fee\u6539\u4e86\u9810\u8a2d\u7684 Makefile \u7684\u5167\u5bb9\uff0c\u52a0\u5165 include \u76ee\u9304\u7684 cpp \u7de8\u8b6f\uff08\u56e0\u70ba BeMqttClient \u7684\u539f\u59cb\u78bc\u653e\u5728\u9019\u88e1\uff09\uff0c\u4e26\u53ef\u652f\u63f4 macOS \u8207 Linux \u7684\u74b0\u5883\uff08\u56e0\u70ba macOS \u6c92\u6709 -luuid \u5426\u5247\u7de8\u8b6f\u6703\u51fa\u932f\u3002-luuid \u662f Linux \u74b0\u5883\u4e0b\u7684 uuid \u5957\u4ef6\uff0c\u4ea6\u9700\u7528 apt \u5b89\u88dd uuid-dev \u624d\u80fd\u4f7f\u7528\u3002\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u622a\u5716_2020-10-25_\u4e0a\u534810_43_41.png\" height=\"441\" src=\"https:\/\/pic.pimg.tw\/benjenq\/1603594462-2783508349-g.png\" title=\"\u622a\u5716_2020-10-25_\u4e0a\u534810_43_41.png\" width=\"640\"><\/p>\n<p>\u82e5\u5c0d\u9019\u500b\u81ea\u8a02 class \u985e\u5225\u5167\u5bb9\u6709\u8208\u8da3\u7684\u8a71\uff0c\u8acb\u8b80\u8005\u5011\u81ea\u884c\u4e0a&nbsp;<a href=\"https:\/\/github.com\/benjenq\/BeMqttSample\" target=\"_blank\">github.com\/benjenq\/BeMqttSample<\/a> \u53c3\u8003\u56c9\uff01<\/p>\n<p>&nbsp;<\/p>\n<p><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><script src=\"chrome-extension:\/\/hhojmcideegachlhfgfdhailpfhgknjm\/web_accessible_resources\/index.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e5d\u6708\u6642\u5de5\u4f5c\u4e0a\u63a5\u5230\u4e00\u9805\u4efb\u52d9\uff0c\u5167\u5bb9\u662f\u8a55\u4f30\u67d0\u786c\u9ad4\u65b9\u6848\u7684\u53ef\u80fd\u6027\u3002\u8a72\u786c\u9ad4\u8a2d\u5099\u5ee0\u5546\u6709\u63d0\u4f9b Windows \u8207 Linux  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[51],"tags":[],"class_list":["post-3850","post","type-post","status-publish","format-standard","hentry","category-51"],"_links":{"self":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/posts\/3850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/comments?post=3850"}],"version-history":[{"count":0,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/posts\/3850\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/media?parent=3850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/categories?post=3850"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjenq.ddns.net\/blog\/wp-json\/wp\/v2\/tags?post=3850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}