{"id":206,"date":"2020-10-15T16:59:12","date_gmt":"2020-10-15T08:59:12","guid":{"rendered":"https:\/\/www.guger.top\/?p=206"},"modified":"2020-10-16T12:29:11","modified_gmt":"2020-10-16T04:29:11","slug":"%e7%94%a8eclipse%e6%9d%a5%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91hi3516%e7%9a%84c-c%e5%b7%a5%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.guger.top\/index.php\/2020\/10\/15\/%e7%94%a8eclipse%e6%9d%a5%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91hi3516%e7%9a%84c-c%e5%b7%a5%e7%a8%8b\/","title":{"rendered":"\u7528eclipse\u6765\u4ea4\u53c9\u7f16\u8bd1hi3516\u7684c\/c++\u5de5\u7a0b"},"content":{"rendered":"<p>\u9996\u5148\u5148\u53bbeclipse<a href=\"https:\/\/www.eclipse.org\/downloads\/\" target=\"_blank\"  rel=\"nofollow\" >\u4e0b\u8f7d<\/a>\uff0c\u5efa\u8bae\u7136\u540e\u6b63\u5e38\u8fdb\u884c\u5b89\u88c5\uff0c\u5f53\u7136\u4e2d\u9014\u8fd8\u4f1a\u4e0b\u8f7djdk\u7684\u63d2\u4ef6\uff0c\u9759\u9759\u7b49\u5f85\u5c31\u597d\uff0c\u5b89\u88c5\u597d\u540e\u9009\u62e9\u5de5\u4f5c\u533a\uff0c\u5f00\u59cb\u51c6\u5907\u642d\u5efa\uff08\u4e00\u884c\u5b57\u4e00\u4e0b\u5348\uff09<\/p>\n<h2>c\u5de5\u7a0b<\/h2>\n<p>\u8fd9\u90e8\u5206\u5c31\u662f\u6d4b\u8bd5\u4ea4\u53c9\u7f16\u8bd1\u94fe\u7684\u914d\u7f6e\uff0c<img decoding=\"async\" title=\"image.png\" src=\"https:\/\/cache.image.guger.top\/2020\/10\/15\/8c6f960145194.png\" alt=\"image.png\" \/><br \/>\n<img decoding=\"async\" title=\"image.png\" src=\"https:\/\/cache.image.guger.top\/2020\/10\/15\/b8b2a98906f40.png\" alt=\"image.png\" \/><br \/>\n\u7136\u540e\u7b49\u5f85\u5efa\u7acb\u4e86\u65b0\u7684\u7a7a\u5de5\u7a0b\uff0c\u91cc\u9762\u5c31\u6709\u9ed8\u8ba4\u7684include\u6587\u4ef6\uff0c\u6dfb\u52a0\u65b0\u7684\u4ee3\u7801\u6587\u4ef6\u7136\u540e\u968f\u4fbf\u5199\u70b9\u4ee3\u7801\u7136\u540e\u70b9\u51fb\u5c0f\u9524\u5b50build\u5373\u53ef<img decoding=\"async\" title=\"image.png\" src=\"https:\/\/cache.image.guger.top\/2020\/10\/15\/13e3665741707.png\" alt=\"image.png\" \/><\/p>\n<h2>c\/c++\/opencv\u5de5\u7a0b<\/h2>\n<p>\u521b\u5efa\u5de5\u7a0b\u4e5f\u662f\u5dee\u4e0d\u591a\u7684\u8def\u6570\uff0c\u91cd\u8981\u7684\u662fc\u8c03\u7528c++\u51fd\u6570\u9996\u5148\u5728project-&gt;properties(\u5feb\u6377\u952ealt+enter)-&gt;c\/c++ build-&gt;settings-&gt;cross G++ linker\u6dfb\u52a0\u76f8\u5173\u94fe\u63a5\u5e93\u7684\u53c2\u6570<br \/>\n<img decoding=\"async\" title=\"image.png\" src=\"https:\/\/cache.image.guger.top\/2020\/10\/15\/9909d8b109a7d.png\" alt=\"image.png\" \/>\u8fd8\u6709opencv\u7684include\u6587\u4ef6\u5939\uff0c\u5728-I\u7684\u76f8\u5173\u53c2\u6570\u91cc\uff0c\u5728\u8fd9\u91cc\u603b\u7ed3\u4e00\u4e0b<br \/>\n-D\u662fdefine symbol -I\u662finclude paths \u662f\u8def\u5f84\uff0c-include\u662f\u5934\u6587\u4ef6 linker\u91cc\u7684libraries\u662f\u76f8\u5173\u52a8\u6001\u5e93\u7684\u8c03\u7528\uff0c\u5c31\u662f\u540e\u7f00\u662f.so\u7684\u6587\u4ef6\uff0c\u5e93\u6587\u4ef6\u540d\u4e3a\u6587\u4ef6\u540d\u4e2d\u7684lib(name).so\u6587\u4ef6\u4e2d\u7684name\u90e8\u5206\u3002\u4f8blibopencv_world.so\u91cc\u9762\u5199\u7684\u5c31\u662fopencv_world -L\u662f\u5e93\u6587\u4ef6\u8def\u5f84\u3002\u5728miscellaneous\u662f\u5176\u4ed6\u914d\u7f6e\u53c2\u6570\uff0c\u5728linker\u7684other objects\u91cc\u662f\u9759\u6001\u5e93\u7684\u8def\u5f84\u586b\u5199\uff0c\u5199\u7edd\u5bf9\u8def\u5f84\u5373\u53ef\u3002\u7f16\u8bd1\u5668\u7684miscellaneous\u662f\u7f16\u8bd1\u7684\u5176\u4ed6\u53c2\u6570\uff0c\u5176\u4e2d-Wl\u662f\u4f20\u9012\u7ed9\u8fde\u63a5\u5668\u7684\u53c2\u6570\u3002\u586b\u5199\u5b8c\u6210\u540e\u5373\u53ef apply and close \u3002<br \/>\n\u6df7\u5408\u7f16\u8bd1\u8981\u6ce8\u610f\uff0cclass\u7c7b\u4e0d\u80fd\u51fa\u73b0\u5728c\u8bed\u8a00\u91cc\uff0c\u5982\u679c\u9700\u8981\u76f8\u5173\u6570\u636e\u4f7f\u7528void*\u7684\u6307\u9488\u94fe\u63a5\u51fa\u6765\uff0c\u76f8\u5173\u7684\u94fe\u63a5\u51fd\u6570\u9700\u8981\u5199\u4e24\u4e2a\u5934\u6587\u4ef6\u3002<br \/>\n\u4f8b\u5efa\u7acb\u4e86\u4e00\u4e2a\u5de5\u7a0b\u6587\u4ef6\u7ed3\u6784\u5982\u4e0b\uff1a<br \/>\n\u251c\u2500\u2500 gf<br \/>\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ggc.h<br \/>\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ggcpp.cpp<br \/>\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 ggcpp.h<br \/>\n\u2514\u2500\u2500 main.c<br \/>\n\"main.c\"<\/p>\n<pre class=\"hl\"><code class=\"c\">#include &lt;stdio.h&gt;\r\n#include \"gf\/ggc.h\"\r\nint main (void)\r\n{\r\nint f=12;\r\ncpptoc(f);\r\nf++;\r\ncpptomat(f);\r\nreturn 0;\r\n}<\/code><\/pre>\n<p>\"gf\/gcc.h\"<\/p>\n<pre class=\"hl\"><code class=\"cpp\">#ifndef GF_GGC_H_\r\n#define GF_GGC_H_\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"{\r\n#endif\r\n\r\nvoid cpptoc(int f);\r\nvoid cpptomat(int d);\r\n\r\n#ifdef  __cplusplus\r\n}\r\n#endif\r\n\r\n#endif<\/code><\/pre>\n<p>\"gf\/ggcpp.h\"<\/p>\n<pre class=\"hl\"><code class=\"cpp\">#ifndef GF_GGCPP_H_\r\n#define GF_GGCPP_H_\r\n#include &lt;stdio.h&gt;\r\n#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nclass gof\r\n{\r\npublic:\r\n\tint f;\r\n\r\n\tvoid gfprint(void);\r\n\r\n\tvoid gwprint(int f);\r\n\r\n\r\n};<\/code><\/pre>\n<p>\"gf\/ggcpp.cpp\"<\/p>\n<pre class=\"hl\"><code class=\"cpp\">#include \r\n#include \"ggcpp.h\"\r\n#include \"ggc.h\"\r\n#include &lt;opencv2\/highgui.hpp&gt;\r\n#include &lt;opencv2\/core.hpp&gt;\r\n#include &lt;opencv2\/imgcodecs.hpp&gt;\r\n\r\nusing namespace std;\r\nusing namespace cv;\r\n\r\n\r\nvoid gof::gfprint(void)\r\n{\r\n\tcout&lt;&lt;\"hello world\"&lt;&lt;endl;\r\n\r\n}\r\nvoid gof::gwprint(int f)\r\n{\r\n\tcout&lt;&lt;\"f is\"&lt;&lt;f&lt;&lt;endl;\r\n\r\n}\r\n\r\n\r\nvoid cpptoc(int f)\r\n{\r\n\tgof g;\r\n\tg.gwprint(f);\r\n}\r\nvoid cpptomat(int d)\r\n{\r\n\tMat image(1920, 1080, CV_8UC1);\r\n\tgof g;\r\n\r\n\tfor (int i = 0; i &lt; image.cols; i++)\r\n\t{\r\n\t\tuchar* p = image.ptr(i);\r\n\t\tfor (int j = 0; j &lt; image.rows; j++)\r\n\t\t{\r\n\t\t\tif (i &lt; 80 &amp;&amp; i&gt;50)\r\n\t\t\t{\r\n\t\t\t\tp[j] = 0;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tp[j] = 255;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tg.gwprint(d);\r\n\timwrite(\"demo.jpg\", image);\r\n}<\/code><\/pre>\n<p>\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u7528c++\u6253\u5305\u6210c\u7684\u51fd\u6570\uff0c\u6240\u6709\u4e0ec++\u76f8\u5173\u7684\u7279\u6027\u5168\u90e8\u6253\u5305\uff0c\u5148\u5173\u8c03\u7528\u63a5\u53e3\u5168\u662f\u6307\u9488\u5373\u53ef\u3002\u5c31\u53ef\u4ee5\u987a\u5229\u8c03\u7528\u4e86<\/p>\n<p>&lt;img src=\"https:\/\/cache.image.guger.top\/2020\/10\/15\/42a12a435ef0c.png\" alt=\"image.png\" title=\"image.png\" \/&gt;<\/p>\n<p>ok<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u5148\u53bbeclipse\u4e0b\u8f7d\uff0c\u5efa\u8bae\u7136\u540e\u6b63\u5e38\u8fdb\u884c\u5b89\u88c5\uff0c\u5f53\u7136\u4e2d\u9014\u8fd8\u4f1a\u4e0b\u8f7djdk\u7684\u63d2\u4ef6\uff0c\u9759\u9759\u7b49\u5f85\u5c31\u597d\uff0c\u5b89\u88c5\u597d\u540e\u9009\u62e9\u5de5\u4f5c\u533a\uff0c\u5f00\u59cb\u51c6\u5907\u642d\u5efa\uff08\u4e00 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":""},"categories":[3,21],"tags":[],"class_list":["post-206","post","type-post","status-publish","format-standard","hentry","category-opencv","category-21"],"_links":{"self":[{"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/posts\/206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/comments?post=206"}],"version-history":[{"count":0,"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/posts\/206\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/media?parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/categories?post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guger.top\/index.php\/wp-json\/wp\/v2\/tags?post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}