{"id":139521,"date":"2020-07-15T19:42:31","date_gmt":"2020-07-15T11:42:31","guid":{"rendered":"http:\/\/4563.org\/?p=139521"},"modified":"2020-07-15T19:42:31","modified_gmt":"2020-07-15T11:42:31","slug":"vscode-%e6%80%8e%e4%b9%88-include-opencv2","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=139521","title":{"rendered":"vscode \u600e\u4e48 include opencv2?"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  vscode \u600e\u4e48 include opencv2?               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaoming1992 <\/span>  <span><i><\/i> 12<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u521d\u5b66 cpp<br \/> \u6211\u628a opencv \u4e0b\u8f7d\u5230\u4e86\u4e00\u4e2a\u5355\u72ec\u7684\u76ee\u5f55\u4e0b<\/p>\n<pre><code>cpp-libs |--opencv |--|--sources |--|--build |--|--|--bin |--|--|--x64 |--|--|--include |--|--|--|--opencv2 |--|--|--|--|--core |--|--|--|--|--|--core.hpp \u7b49\u6587\u4ef6 \/\u76ee\u5f55 <\/code><\/pre>\n<p><code>c_cpp_properties.json<\/code>\u6587\u4ef6\u5982\u4e0b:<\/p>\n<pre><code>{     \"configurations\": [         {             \"name\": \"Win32\",             \"includePath\": [                 \"${workspaceFolder}\/**\",                 \"${default}\",                 \"C:\/cpp-libs\/opencv\/build\/include\"             ],             \"defines\": [                 \"_DEBUG\",                 \"UNICODE\",                 \"_UNICODE\"             ],             \"compilerPath\": \"C:\\MinGW\\bin\\g++.exe\",             \"cStandard\": \"c11\",             \"cppStandard\": \"gnu++14\",             \"intelliSenseMode\": \"clang-x86\"         }     ],     \"version\": 4 } <\/code><\/pre>\n<p>\u6211\u5728<code>.cpp<\/code>\u6587\u4ef6\u4e2d\u5f15\u5165<code>opencv2<\/code>\u5982\u4e0b:<\/p>\n<pre><code>#include &lt;opencv2\/core\/core.hpp&gt; <\/code><\/pre>\n<p>\u4e3a\u4ec0\u4e48 include \u8fd9\u4e2a\u8def\u5f84(<code>C:\/cpp-libs\/opencv\/build\/include<\/code>)\u8fd8\u4e0d\u591f, F5 \u8c03\u8bd5\u65f6\u4f9d\u7136\u63d0\u793a <code>fatal error: opencv2\/core\/core.hpp: No such file or directory<\/code>, includePath \u5230\u5e95\u5e94\u8be5\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>ps: \u6ca1\u7528 visual studio, \u592a\u5927\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>7<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2639154\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nannanziyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xiaoming1992 <br \/>c_cpp_properties.json \u91cc\u7684 inlucdePath \u53ea\u7528\u4e8e Code Intelligence<br \/>\u4f60\u8981\u5728 tasks.json \u91cc\u7528 -I \u53c2\u6570\u6765\u5bf9 build \u547d\u4ee4\u884c\u589e\u52a0 Include Path<br \/>\u6bd4\u5982<\/p>\n<p> &#8220;command&#8221;: &#8220;g++&#8221;,<br \/> &#8220;args&#8221;: [<br \/> &#8220;${file}&#8221;,<br \/> &#8220;-g&#8221;,<br \/> &#8220;-std=c++17&#8221;,<br \/> &#8220;-Wall&#8221;,<br \/> &#8220;-o&#8221;,<br \/> &#8220;${fileDirname}\\${fileBasenameNoExtension}.exe&#8221;,<br \/> &#8220;-I&#8221;,<br \/> &#8220;C:\/cpp-libs\/opencv\/build\/include&#8221;,<br \/> ]                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2639155\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiaoming1992 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @nannanziyu \u8c22\u8c22\uff0c\u786e\u5b9e\u662f\u8fd9\u6837\uff0c\u5728`tasks.json`\u4e2d\u6dfb\u52a0\u53c2\u6570\u540e\u5c31\u53ef\u4ee5\u7f16\u8bd1\u4e86\u3002 <br \/>\u53ef\u662f\u7f16\u8bd1\u540e\u53c8\u62a5`&#8217;recursive_mutex&#8217; in namespace &#8216;std&#8217; does not name a type`\u9519\u8bef\uff0c`stackoverflow`\u4e0a\u6709\u7c7b\u4f3c\u7684\u95ee\u9898[https:\/\/stackoverflow.com\/questions\/14191566\/c-mutex-in-namespace-std-does-not-name-a-type]( https:\/\/stackoverflow.com\/questions\/14191566\/c-mutex-in-namespace-std-does-not-name-a-type)\uff0c\u5f53\u7136 google \u4e0a\u6709\u5f88\u591a\u76f8\u5173\u95ee\u9898\uff0c\u4f46\u662f\u5927\u591a\u90fd\u8bf4\u662f\u7f16\u8bd1\u5668\u7684\u95ee\u9898 <br \/>\u6628\u5929\u8bd5\u4e86\u4e00\u4e0b\uff0c\u628a google \u5230\u7684\u56de\u7b54\u4e2d\u63a8\u8350\u7684\u7f16\u8bd1\u5668\u51e0\u4e4e\u90fd\u8bd5\u4e86\u4e00\u4e0b\uff0c\u8fd8\u662f\u4e0d\u884c\uff0c\u5b9e\u5728\u662f\u641e\u4e0d\u6765\u4e86\uff0c\u53c8\u628a vs2019 \u4e0b\u56de\u6765\u4e86\uff0c\u5b9e\u5728\u662f\u4e0d\u60f3\u4e0b\u8fd9\u4e2a\uff0c\u592a\u5927\u4e86\uff0c\u516c\u53f8\u7535\u8111\u53c8\u592a\u635e\uff0c\u4f46\u662f\u6ca1\u529e\u6cd5\uff0c\u5e94\u8be5\u662f\u6211\u592a\u635e\u4e86\uff0c\u641e\u4e0d\u6765\uff0c\u7b97\u4e86\u7b97\u4e86\uff0c\u4e0d\u6298\u817e\u4e86\u3002\u518d\u6b21\u611f\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2639156\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nannanziyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. recursive_mutex \u5c5e\u4e8e posix thread\uff0c\u6240\u4ee5\u4f60\u7684 gcc \u8981\u4e0b\u8f7d posix thread \u7684<br \/>\u6bd4\u5982\u7528 MinGW-64<br \/>https:\/\/sourceforge.net\/projects\/mingw-w64\/files\/Toolchains%20targetting%20Win64\/<br \/>\u4e0b\u8f7d\u8fd9\u4e2a\u9875\u9762\u4e2d\u7684 x86_64-posix-seh<br \/>2. opencv \u4e5f\u8981\u4e0b\u8f7d\u5bf9\u5e94\u7684 build<br \/>https:\/\/github.com\/huihut\/OpenCV-MinGW-Build\uff0c\u4e0d\u7136\u53ef\u4ee5\u7f16\u8bd1\uff0c\u4f46\u65e0\u6cd5 link<br \/>3. vs2019 \u5f88\u5c0f\uff0c\u6700\u5c0f\u5b89\u88c5\u53ea\u8981 800M \u3002\u5927\u662f\u56e0\u4e3a\u4f60\u628a msvc \u548c sdk \u90fd\u88c5\u4e0a\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2639157\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nannanziyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div> <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/07\/20200727_5f1f4dbf5db94.gif\" rel=\"noreferrer\" alt=\"vscode \u600e\u4e48 include opencv2?\"><\/p>\n<p>task.json<br \/>{<br \/> \/\/ See https:\/\/go.microsoft.com\/fwlink\/?LinkId=733558<br \/> \/\/ for the documentation about the tasks.json format<br \/> &#8220;version&#8221;: &#8220;2.0.0&#8221;,<br \/> &#8220;tasks&#8221;: [<br \/> {<br \/> &#8220;label&#8221;: &#8220;build&#8221;,<br \/> &#8220;type&#8221;: &#8220;shell&#8221;,<br \/> &#8220;command&#8221;: &#8220;g++&#8221;,<br \/> &#8220;args&#8221;: [<br \/> &#8220;${file}&#8221;,<br \/> &#8220;-g&#8221;,<br \/> &#8220;-std=c++17&#8221;,<br \/> &#8220;-Wall&#8221;,<br \/> &#8220;-o&#8221;,<br \/> &#8220;${fileDirname}\\${fileBasenameNoExtension}.exe&#8221;,<br \/> &#8220;-I&#8221;,<br \/> &#8220;F:\/Download\/OpenCV-MinGW-Build-OpenCV-4.1.1-x64\/include&#8221;,<br \/> &#8220;-LF:\/Download\/OpenCV-MinGW-Build-OpenCV-4.1.1-x64\/x64\/mingw\/lib&#8221;,<br \/> &#8220;-llibopencv_core411&#8221;,<br \/> &#8220;-llibopencv_imgcodecs411&#8221;,<br \/> &#8220;-llibopencv_highgui411&#8221;<br \/> ]<br \/> }<br \/> ]<br \/>}<\/p>\n<p>launch.json<br \/>{<br \/> \/\/ Use IntelliSense to learn about possible attributes.<br \/> \/\/ Hover to view descriptions of existing attributes.<br \/> \/\/ For more information, visit: https:\/\/go.microsoft.com\/fwlink\/?linkid=830387<br \/> &#8220;version&#8221;: &#8220;0.2.0&#8221;,<br \/> &#8220;configurations&#8221;: [<br \/> {<br \/> &#8220;name&#8221;: &#8220;(gdb) Launch&#8221;,<br \/> &#8220;type&#8221;: &#8220;cppdbg&#8221;,<br \/> &#8220;request&#8221;: &#8220;launch&#8221;,<br \/> &#8220;program&#8221;: &#8220;${workspaceFolder}\/${fileBasenameNoExtension}.exe&#8221;,<br \/> &#8220;args&#8221;: [],<br \/> &#8220;stopAtEntry&#8221;: false,<br \/> &#8220;cwd&#8221;: &#8220;${workspaceFolder}&#8221;,<br \/> &#8220;environment&#8221;: [],<br \/> &#8220;externalConsole&#8221;: false,<br \/> &#8220;MIMode&#8221;: &#8220;gdb&#8221;,<br \/> &#8220;miDebuggerPath&#8221;: &#8220;gdb&#8221;,<br \/> &#8220;setupCommands&#8221;: [<br \/> {<br \/> &#8220;description&#8221;: &#8220;Enable pretty-printing for gdb&#8221;,<br \/> &#8220;text&#8221;: &#8220;-enable-pretty-printing&#8221;,<br \/> &#8220;ignoreFailures&#8221;: true<br \/> }<br \/> ],<br \/> &#8220;preLaunchTask&#8221;: &#8220;build&#8221;<br \/> }<br \/> ]<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2639158\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : xiaoming1992 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u8c22\u611f\u8c22\uff0c\u90a3\u5e94\u8be5\u662f\u6211\u7684 opencv \u7248\u672c\u4e0d\u5bf9\uff0c\u56e0\u4e3a\u662f\u5f88\u4e45\u4e4b\u524d\u4e0b\u7684\uff0c\u5199\u4e86\u4e00\u70b9\u56fe\u7247\u5904\u7406\u76f8\u5173\u7684\u4e1c\u897f\uff0c\u5f53\u65f6\u7528\u7684 vs2019 \u8dd1\u7684\u597d\u597d\u7684\uff0c\u56e0\u4e3a\u5904\u7406\u6548\u679c\u4e0d\u597d(\u7a0b\u5e8f\u592a\u635e)\u5c31\u6401\u7f6e\u4e86\uff0c\u7136\u540e\u53c8\u5378\u8f7d\u4e86 vs\uff0c\u73b0\u5728\u6361\u8d77\u6765\u7528 vscode \u7ed3\u679c\u8dd1\u4e0d\u8d77\u6765\u4e86\u3002\u3002\u3002 <\/p>\n<p>\u4f60\u8bf4\u7684\u90a3\u4e2a mingw-64 \u90a3\u4e2a\u7248\u672c\u6211\u5e94\u8be5(?)\u662f\u4e0b\u8f7d\u8fc7\u7684\uff0c\u4f46\u662f\u5f53\u65f6\u4f30\u8ba1\u662f opencv \u7248\u672c\u4e0d\u5bf9\uff0c\u4ecd\u7136\u8dd1\u4e0d\u8d77\u6765\uff0c\u5f85\u4f1a\u518d\u8bd5\u4e00\u8bd5\uff0c\u518d\u6b21\u611f\u8c22\uff0c\u73b0\u5728\u613f\u610f\u50cf\u4f60\u8fd9\u4e48\u8be6\u7ec6\u5730\u7ed9\u65b0\u4eba\u8bb2\u89e3\u8fd9\u79cd\u57fa\u7840\u95ee\u9898\u7684\u4e0d\u591a\u4e86                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2639159\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nannanziyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xiaoming1992 <br \/>1. \u4e0d\u662f\u7684\uff0copencv \u7248\u672c\u4e0d\u5bf9\uff0c\u53ea\u4f1a\u5bfc\u81f4 link \u5931\u8d25\uff0c\u7f16\u8bd1\u662f\u4f1a\u901a\u8fc7\u7684<br \/>2. \u4f60\u7528\u7684\u662f win32 thread \u7684 MinGW-64\uff0c\u6240\u4ee5\u4f1a\u63d0\u793a\u4e0d\u5b58\u5728 std::recursive_mutex<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/07\/20200727_5f1f4dc34975b.png\" rel=\"noreferrer\" alt=\"vscode \u600e\u4e48 include opencv2?\"> <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2639160\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nannanziyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xiaoming1992 <br \/><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/07\/20200727_5f1f4dc8328f0.png\" rel=\"noreferrer\" alt=\"vscode \u600e\u4e48 include opencv2?\"><br \/>\u7eff\u6846\u7684\u662f posix thread \u7684 MinGW\uff0c\u7f16\u8bd1 opencv \u6210\u529f<br \/>\u7ea2\u6846\u7684\u662f\u7528 win32 thread \u7684 MinGW\uff0c\u62a5\u9519 std::recursive_mutex \u4e0d\u5b58\u5728                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>vscode \u600e\u4e48 include&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/139521"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139521"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/139521\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139521"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}