问题描述
我正在尝试将 MITK 与 Qt Creator 结合使用.我已经通过ccmake成功编译并使用了VTK和ITK.
I'm trying to use MITK with Qt Creator. I've successfully compiled and used VTK and ITK with ccmake.
我在超级构建模式下编译了 MITK(它下载 CTK、VTK、ITK 等).那我就配置好了.我已经用 make 编译了(大约两个小时).
I've compiled MITK in superbuild mode (it downloads CTK, VTK, ITK, etc). Then I've configured it. I've compiled with make (About two hours).
我试过 make install,但 MITK 不能那样工作.
I've tried make install, but MITK doesn't work that way.
使用 GDCM、ITK、VTK,我可以在 /usr/local/include 中找到头文件,在 /usr/local/lib 中找到共享库,所以我包含了我在 Qt Creator 项目中的 .pro 文件中的那些并开始工作.
With GDCM, ITK, VTK, I could find header files in /usr/local/include and shared libs in /usr/local/lib, so I included those in my .pro file in the Qt Creator project and start working.
我一直在查看MITK-superbuild文件夹-编译后-,但是我找不到,例如QmitkRenderWindow.h,它是第一个我需要的.
I've been looking inside MITK-superbuild folder -after compilation-, but I can't find, for example, QmitkRenderWindow.h, and it's the first one I need.
我正在研究 MITK 文档:http://docs.mitk.org/nightly-qt4/BuildInstructionsPage.html
I'm looking into MITK doc:http://docs.mitk.org/nightly-qt4/BuildInstructionsPage.html
我有一个带有 .pro 文件的现有项目,所以我不知道如何继续.
I have an existing project with a .pro file, so I don't know how to continue.
好的,如下:http://doc.qt.digia.com/qtcreator-2.4/creator-project-cmake.html和上一个链接,我创建了一个 CMakeLists.txt 并将构建目录更改为 MITK-build 文件夹.
Edited: ok, following this:http://doc.qt.digia.com/qtcreator-2.4/creator-project-cmake.htmland the previous link, I created a CMakeLists.txt and changed the build directory to MITK-build folder.
现在我可以自动完成将 .h 标头添加到代码中.我必须导航到子文件夹.
Now I have autocomplete adding .h headers into code. I have to navigate into subfolders.
MITK-build 是要添加的正确文件夹吗?我这样说是因为 QmitkRenderWindow.h 不在那里,它在 MITK-src 中,我在编译 MITK 之前下载了它.
Is MITK-build the right folder to add? I say this because QmitkRenderWindow.h is not there, it's in MITK-src, which I've downloaded before compiling MITK.
推荐答案
Qt Creator 支持原生 CMake.MITK、VTK 和 ITK 由 CMake 管理.因此,要在 CMake Projekt 中使用 Qt Creator,只需打开文件 CMakeLists.txt 作为项目文件.(文件->打开文件或项目...).正如您已经提到的,VTK/ITK/MITK 应该构建为影子构建,因此源文件和构建文件被拆分在不同的目录中.加载 CMakeLists.txt 后,QtCreator 会询问您构建项目的目录.
Qt Creator supports native CMake. MITK, VTK and ITK are managed by CMake. So to use Qt Creator with a CMake Projekt, simply open the file CMakeLists.txt as Project File. (File->Open File or Project ...). As you already mentioned, VTK/ITK/MITK are supposed to be build as a shadow build, so source and build files are split in different directories. After loading the CMakeLists.txt QtCreator asks you for a directory where to build the project.
在 MITK 项目的情况下,您必须区分 superbuild 和和仅构建 MITK.由于您已经有了一个超级构建,只需将构建目录更改为子目录 MITK-build.要打开 superbuild-project,请选择上面的目录.请注意,在这两种情况下,您都可以使用相同的 CMakeLists.txt
In case of the MITK Project you have to differ between superbuild and and building MITK only. As you already have a superbuild, simply change the build directory to the subdir MITK-build. To open the superbuild-project, choose the direcotory above. Notice that in both cases you can use the same CMakeLists.txt
顺便说一句,要配置您的构建,您可以使用非常好的 gui 程序 cmake-gui,您可以在 linux(基于 apt)的包 cmake-qt-gui 中找到该程序.
Btw, to configure your build you can use the very nice gui program cmake-gui, which you can find in linux (apt-based) in the package cmake-qt-gui.
希望能帮到你.=)
这篇关于Qt Creator + MITK (Linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!