Mac OS下用Qt Creator/Xcode打开CMake工程

刚打开会报错:
error: Qt Creator needs a CMake Tool set up to build. Configure a CMake Tool in the kit options.
原因:http://doc.qt.io/qtcreator/creator-project-cmake.html
就是说你根本没往Qt中添加Cmake可执行文件的路径

1,添加cmake路径:
在命令行输入

which cmake

会输出cmake的路径,添加到Qt的build and run的cmake里面
2,把这个cmake添加到kit
上面的cmake会自动添加到kit里
但是还是报错:
The kit Desktop Qt 5.8.0 clang 64bit has configuration issues which might be the root cause for this problem.
如果用命令行执行cmake会提示找不到OpenCV,先解决这个问题。
参考http://www.luohanjie.com/2016-11-14/compilation-of-opencv-under-mac-counld-not-find-module-findopencv-cmake-wrong-solution.html
**执行

brew ln opencv3 --force

提示
Linking /usr/local/Cellar/opencv3/3.2.0… 58 symlinks created
If you need to have this software first in your PATH instead consider running:
echo ‘export PATH=”/usr/local/opt/opencv3/bin:$PATH”’ >> ~/.bash_profile
也就是上面那句话创建了很多关于opencv的所以以便程序可以找到。
命令行下编译成功!**

再回到Qt下编译:
报错:No CMAKE_C_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable “CC” or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
解决不了
0415更新:
在CMakeLists.txt第二行加入

SET( CMAKE_CXX_COMPILER "g++") #设定编译器
SET( CMAKE_C_COMPILER "gcc") #设定编译器

就好了!!!!!!!!!!!!!!!!也就是要在PROJECT之前才可以

想用xcode直接打开cmake工程,教程:https://www.youtube.com/watch?v=-uEXVOzd364
1,下载cmake gui工具,选如下图
这里写图片描述
第一次configure好像不会让你选择generator,选择菜单栏file-delete cache然后再configure会让你选择,选择xcode,然后,configure,generate会生成xcode的工程文件,打开即可

2,选择run的参数:
选择xcode菜单栏的
这里写图片描述
然后在run里输入
/Users/kylefan/program/stitching/image/1.jpg /Users/kylefan/program/stitching/image/2.jpg /Users/kylefan/program/stitching/image/3.jpg /Users/kylefan/program/stitching/image/4.jpg /Users/kylefan/program/stitching/image/5.jpg
保存

3,选择执行stitching:
这里写图片描述
这样才能运行想要的程序。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值