添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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. My primary IDE is VS but I've grown to like Qt Creator too. 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? Or should I create VS project first and create .pro file by Qt integration utilities? 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. Using scoping rules I can set options that are specific for the VC++ compiler or the MinGW compiler. I haven't encountered any VS option yet I couldn't specify in a .pro file. 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.

For adding new files to the project I sometimes just add them to the .pro files and setup the VS project again. 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)

You can as far as I know. In the .pro file specify the files in the format 'SOURCES += subdir/file.cpp'. I don't know how they will be displayed in VS, though. Ben Aug 29, 2009 at 22:19

Do you mean Qt Designer or Qt Creator? Qt Designer is the form builder, Qt Creator is the IDE.

I would recommend delegating your project management to CMake . Qt Creator now has support for cmake. cmake generates you project files based on a simple set of description files. 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. 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.

I am glad you were able to solve you current issue QT Creator is a great tool. 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.

I have had good luck using CMake ( http://cmake.org/ ) to generate my project files. I am working on a Linux/windows project where the developers can use just about any IDE and compiler. Learning to use CMake is easy, learning to make good cmake scripts takes a little time though. 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.

Like this I have worked with visual studio, Code::blocks, QT Creator, clang, gcc/mingw and the vc++ compiler.

My approach was to create the project in VC++ and then export it to 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.
  • 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.
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .