刚打开会报错: 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: 这样才能运行想要的程序。