Windows11/vscode/C++/opencv4.7.0/openc-contrib/cmake配置(文字版,改天发个视
时间:2023-04-19 07:39:12 来源:哔哩哔哩
1) Unzip these archives, you can use default unzip path or create your own. Better separate them.
2) Open cmake-gui. Or if you are fairly familiar with camke cmdlines, skip this step.
(资料图片)
3) Choose compiler you want to use, MinGW can be used if you would like to compile your projects in vscode.
If you are using Microsoft visual studio, don't bother to compile opencv from source codes.
Releases, marked by windows icon and text you can download straight from "https://opencv.org/releases/" are already compiled by MSVC.
Just google how to config it.
In this case, MinGW is used.
4) Config your Gcc and G++ compilers, before which gcc and g++ shall be added system env path. Make sure the system recognises these compilers.
Choose your Gcc and G++.
5) Choose one folder to store generated files. Doesn't have to be where your want store it finally.
6) Click 'configurate'.
7) Configuration takes several minuates, during which downloading components from github repo will be conducted. Surely 'SSL connect error' failures like these occur.
Don't worry and look into each error info in red.
8) Configuration done, red items will be displayed within cmake gui. These are not actually errors but some items you have to configure for a second time, of course third, fourth... .
Some experiences I can share:
-- search python, uncheck all 'cause we are compiling for C/C++;
-- search java, uncheck all for the same reason.
-- search allo, uncheck it for I solved my 'fatal error' which crashed compilation of opencv.
-- search extra, fill or choose your "opencv_contrib/modules" path, containing some 3rd-party non-free algorithms. I just want a complete opencv.
-- click 'add entry', input 'ENABLE_CXX11' to enable new standards.
-- click 'add entry', input 'OPENCV_VS_VSVERSIONINFO_SKIP', make it a bool and value is true. Solved my compilation error by it.
9) In some regions due to internet traffic, downloading components failed.
Quite normal, try to switch to proxy or turn proxy, again and again and again and so on, by click 'configurate' until downloading succeeds.
11) Before clicking 'generate', uncheck 'BUILD_aruco'. Also crushed if checked for me.
12) Click 'generate'.
13) Open cmd or powershell, cd to the path in step 5).
14) Input 'mingw32-make', if you would like to enable multiple threads compiling, input 'mingw32-make -j8'.
8 is how many threads enables, depending on your CPU. I, personally use '-j14' on a 8-core cpu.
15) Wait, preying not a single fatal error.
16) Wait, preying not a single fatal error.
17) Wait, preying not a single fatal error.
18) Keep calm and wait. Keep calm and prey until 100%.
19) Looked into errors, which shouldn't occur. Ignore all warnings.
20) In the cmd opened in step 13), input 'mingw32-make install'.
21) Wait, no need to prey for I haven't seen error in this step.
22) Complete compilation. DO NOT delete any codes.
23) Explorer-open the step 5) folder. Add 'bin' path to system env path.
24) Find the folder named 'install' in the step 5) folder, click 'x64', click 'mingw', add another 'bin' to sys env path.
23 and 24 'bin' in my case contains different contents.
25) Configure in vscode the 'c_cpp_properties.json', find the 'install' folder in 24), go into it and add 'include' path to includePath in the 'c_cpp_properties.json'.
And add 'include/openCV2' to it.
26) Configure in vscode the 'tasks.json'. You shall have at least one building task such as g++, clang++. If you don't write a hello world, vscode will tell you to configure one.
In the 'arg', add "-I", " the-25)-include-path","-I", " the-25)-include/openCV2-path".
Also in the section, find 24) folder, where there are one 'bin' and one 'lib'. Add the 'lib' path like "-L"," the-lib-path ".
27) Continuing 26). Add "-l","libopencv_xxxddd", where 'xxx' stands for module name, 'ddd' for opencv version. For example "-l","libopencv_core470", "-l","libopencv_imgcodecs470".
Opencv version remains the same for all '.a' files in 'lib'. You should add them all to avoid linking issues or add what your needs if they are perfectly clear to you.
28) Try to write an example.
标签:
最新文章推荐
- Windows11/vscode/C++/opencv4.7.0/openc-contrib/cmake配置(文字版,改天发个视
- 环球今热点:紧急停业!淄博一烧烤店老板:保命要紧
- 速讯:智通全球财经日志|4月19日
- 温格:切尔西的5亿欧没有花在刀刃上,他们还是进不了球
- “五一”返程火车票今起开售 这些线路车票或紧张 焦点报道
- 汨罗市政府与国网岳阳供电公司签约
- 如何自微女初中_如何自慰 最新
- 全球百事通!氟斑牙治疗费用_氟斑牙怎么治疗
- 韩国和美日搞“三眼联盟”?_快资讯
- 罗马官方:任命莉娜-苏鲁库为俱乐部CEO兼总经理
- 世界速看:查旺旺号照妖镜_查旺旺
- 高超声速飞行器实时再入轨迹与姿态协调控制策略研究_关于高超声速飞行器实时再入轨迹与姿态协调控制策略研究简述_当前热文
- 郑渊洁在微博发“告别书”:不再发表作品,不再对673个侵权商标维权 速看
- 身为反派的你如何洗白,进来学习这些洗白套路,直接逆袭人生
- 网上预约驾校考试取消有什么影响_网上预约驾校考试 世界微动态
- 奈雪的茶:一季度末经营1106家门店 上调全年门店计划至600家
- 今日小小春jasper名场面_小小春jasper|焦点短讯
- 2023年南陵县大浦乡村世界五一劳动节游玩攻略 播报
- 广汽冯兴亚:自主品牌目前暂时领先,要保持高度的危机感|当前报道
- 兆威机电(003021.SZ)主要股东城聚兆德拟减持不超1%股份_天天新视野
- 上海10家银行与30家民营企业签署授信协议 授信金额1200多亿元
- Spring Cloud Task 任务开发-定义任务输入和输出(一)|环球报道
- 我市水域禁止区域和时段游泳、钓鱼将会被罚款
- 环球观热点:武汉雨阳物业人事变动:李路任董事长,李新华任经理
- 国产新车报道:小鹏汽车P7延期至明年3月上市 二季度交付
- 福布斯2023韩国富豪榜:财富总额连续两年下降,仅15人财富增加_全球新消息
- 太极股份: 关于提前赎回“太极转债”暨即将停止转股的重要提示性公告|环球热点评
- 孩子不做这件事,奶爸竟找来民警……网友:警察能打败魔法_天天热点评
- 颀中科技:4月20日在上交所上市 股票代码688352
- 甘肃省青少年科技创新大赛结果揭晓 20个项目将获推参加全国大赛
X 关闭
资讯中心
2022-05-20
2021-10-18
2021-10-18
2021-10-18
X 关闭
热点资讯
-
1
杏花绽放催热“赏花经济” 吸引了大量游客前来旅游
-
2
上海籍阳性夫妻内蒙古密接、次密接者出现初筛阳性情况
-
3
内蒙古二连浩特:市民非必要不出小区、不出城
-
4
重庆一名潜逃24年的持枪抢劫嫌犯落网
-
5
销售有毒、有害食品 郭美美获刑二年六个月
-
6
陕西新增6名确诊病例1名无症状感染者 西安全面开展排查管控
-
7
《加强建设中国风湿免疫病慢病管理》倡议书:建立基层医院独立风湿科
-
8
游客因未购物遭导游辱骂?九寨沟:相关部门已介入调查
-
9
郭美美再入狱!销售有毒有害食品获刑2年6个月
-
10
2020年黄河青海流域冰川面积和储量较十年前缩减
-
11
5名“摸金校尉”落网 内蒙古警方破获一起盗掘古墓葬案