简体   繁体   English

Visual Studio和Qt Creator中的同步开发

[英]Simultaneous development in Visual Studio and Qt Creator

I'm going to develop a bunch of projects with Qt that should compile both under Visual Studio with Qt integration (commercial) and Qt Creator with LGPL SDK. 我将用Qt开发一堆项目,这些项目应该在Visual Studio下使用Qt集成(商业)和Qt Creator与LGPL SDK进行编译。 My primary IDE is VS but I've grown to like Qt Creator too. 我的主要IDE是VS,但我也逐渐喜欢Qt Creator。 It would be nice to be able to work in both of them simultaneously. 能够同时在两者中工作会很好。 I need to do it in some extent anyway. 无论如何,我需要在某种程度上做到这一点。

The most annoying problem is project management. 最烦人的问题是项目管理。 Should I create .pro file first and then import it to VS? 我应该首先创建.pro文件,然后将其导入VS吗? Or should I create VS project first and create .pro file by Qt integration utilities? 或者我应该首先创建VS项目并通过Qt集成实用程序创建.pro文件? What's the best way to do it? 最好的方法是什么?

I would like to hear your ideas on the subject. 我想听听你对这个问题的看法。

I use the .pro files as a basis and create VS projects from them. 我使用.pro文件作为基础并从中创建VS项目。 Using scoping rules I can set options that are specific for the VC++ compiler or the MinGW compiler. 使用作用域规则我可以​​设置特定于VC ++编译器或MinGW编译器的选项。 I haven't encountered any VS option yet I couldn't specify in a .pro file. 我没有遇到任何VS选项但我无法在.pro文件中指定。 OK, make that one: trying to set the warning level to 4 (win32:QMAKE_CXXFLAGS_DEBUG += /W4) didn't work because /W3 was still present. 好吧,制作那个:尝试将警告级别设置为4(win32:QMAKE_CXXFLAGS_DEBUG + = / W4)不起作用,因为/ W3仍然存在。

For adding new files to the project I sometimes just add them to the .pro files and setup the VS project again. 为了将新文件添加到项目中,我有时只需将它们添加到.pro文件中并再次设置VS项目。 That way I don't have to worry about keeping both in sync. 这样我就不必担心保持同步。

Using this approach makes it easy to do automatic builds under a variety of compilers (Microsoft, Intel, MinGW, 64bit cross compilers) 使用这种方法可以轻松地在各种编译器(Microsoft,Intel,MinGW,64位交叉编译器)下进行自动构建

Do you mean Qt Designer or Qt Creator? 你的意思是Qt Designer还是Qt Creator? Qt Designer is the form builder, Qt Creator is the IDE. Qt Designer是表单构建器,Qt Creator是IDE。

I would recommend delegating your project management to CMake . 我建议将您的项目管理委派给CMake Qt Creator now has support for cmake. Qt Creator现在支持cmake。 cmake generates you project files based on a simple set of description files. cmake根据一组简单的描述文件生成项目文件。 I now use cmake even if I am just using visual studio because it is much easier to manage common settings between related projects than updating loads of settings in different dialog boxes. 我现在使用cmake,即使我只是使用visual studio,因为管理相关项目之间的常见设置比更新不同对话框中的设置负载要容易得多。 It also is also a multi platform build and is very clever at discovering the build tools and libraries installed on the developer system and creating the appropriate build output, make files, and ide project files. 它也是一个多平台构建,非常聪明地发现开发人员系统上安装的构建工具和库,并创建适当的构建输出,make文件和ide项目文件。

I am glad you were able to solve you current issue QT Creator is a great tool. 我很高兴你能解决你当前的问题QT Creator是一个很棒的工具。 As much I like QT Creator and dislike Visual Studio, if you need to work with other developers on windows skipping support for visual studio in the future may not be an option. 我喜欢QT Creator并且不喜欢Visual Studio,如果你需要在Windows上与其他开发人员合作,将来可能不会选择跳过对visual studio的支持。

I have had good luck using CMake ( http://cmake.org/ ) to generate my project files. 我有幸使用CMake( http://cmake.org/ )生成我的项目文件。 I am working on a Linux/windows project where the developers can use just about any IDE and compiler. 我正在开发Linux / Windows项目,开发人员可以使用任何IDE和编译器。 Learning to use CMake is easy, learning to make good cmake scripts takes a little time though. 学习使用CMake很容易,学习制作好的cmake脚本需要一点时间。 However, QT Creator has the ability to create the CMake projects for you, and you can customize and learn just as much of the CMake build script language as you need to. 但是,QT Creator能够为您创建CMake项目,您可以根据需要自定义和学习尽可能多的CMake构建脚本语言。

Like this I have worked with visual studio, Code::blocks, QT Creator, clang, gcc/mingw and the vc++ compiler. 像这样我使用了visual studio,Code :: blocks,QT Creator,clang,gcc / mingw和vc ++编译器。

I have dropped Visual Studio for C++ development. 我已经放弃了Visual Studio for C ++开发。 Now I use only Qt Creator. 现在我只使用Qt Creator。 All the troubles with parallel ways just do not worth it. 并行方式的所有麻烦都不值得。

My approach was to create the project in VC++ and then export it to pro. 我的方法是用VC ++创建项目,然后将其导出到pro。 I then tweaked all the pro files by hand and I keep them in sync by hand. 然后我手动调整所有专业文件,并手动保持同步。

  • It's better to start with VC++, because VC++ has many more options that Qt's pro files. 最好从VC ++开始,因为VC ++有更多Qt专业文件的选项。
  • Once you start changing more advanced options you will want to sync by hand 一旦开始更改更高级的选项,您将需要手动同步
  • Make sure that both toolchains output the files in the same directories, or you might encounter issues such as moc files in your project dir that are updated only by QtCreator, while VC++ only updates the ones in GenratedFiles which the compiler can't see due to the former. 确保两个工具链都输出相同目录中的文件,或者您可能遇到诸如项目目录中仅由QtCreator更新的moc文件之类的问题,而VC ++仅更新GenratedFiles中由编译器无法看到的问题。前者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Qt Creator 中的 Visual Studio 解决方案 - Visual Studio solutions in Qt Creator CMakeLists.txt中的安装目录,适用于Visual Studio和Qt Creator - Installation directory in CMakeLists.txt, suitable for Visual Studio and Qt Creator Qt Creator编译器配置问题Visual Studio 2017 - Qt Creator Compiler Config Issue visual studio 2017 在 Visual Studio 中像 Qt Creator 一样打开 Cmake 项目 - Open Cmake Project in Visual Studio like Qt Creator 如何以与Visual Studio中相同的方式在Qt Creator中生成dll? - How to build dll in Qt creator the same way as in Visual Studio? 如何检测Qt Creator的目标(调试/发布)(Visual Studio) - How to detect Qt Creator's target (debug/release) (Visual Studio) 预处理器定义在 Visual Studio 中有效,在 Qt-creator 中无效 - Preprocessor definition works in Visual Studio and doesn't work in Qt-creator 在Visual Studio和Qt Creator中构建我的项目时,Q_ASSERT具有不同的行为 - Q_ASSERT has different behavior when my project is built in Visual Studio vs. Qt Creator C ++相同的代码永远不会在Visual Studio中编译/运行,有时甚至不会在Qt Creator中运行 - c++ same code compiles/runs never in Visual Studio and sometimes in Qt Creator 从Visual Studio 2015迁移后,Qt Creator不显示Qlabel的边框图像 - Qt Creator not showing border image of Qlabel after migration from Visual Studio 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM