Moving from Visual Studio 2010 to Qt Creator 2.8.1



  • Hi Guys,

    This is my very first Qt forum post, so when I don't comply to the standards, please let me know.

    Currently I'm given a project which is completely developed in Visual Studio 2010. I have a licensed version of Visual Studio 2010 c++ and I've already installed the Qt plugin 1.2.2 opensource. The Qt5 entry shows in the default VS2010 menu bar. So that seems to work.
    While I have quite some experience with Qt5 and Qt Creator (2.8.1), I want to move my complete project from Visual Studio 2010 to Qt Creator 2.8.1
    In my case it doesn't matter which compiler I use, as long as I can run this application on Windows 7 x64 (same OS as where I'm developing on).

    The problem is that I can't find a way to convert the VS2010 project (files) to Qt and Qt Creator format.
    In VS2010 the option to "Convert projects to QMake generated projects" is grayed out. When I right click on the project entry in my Solution Explorer, all Qt related actions are grayed out as well.

    While this is an one-time only migration, I am willing to do this by hand. There aren't a lot of files; 50 classes maximum. So my question is:

    Where can I start with this migration? So I can edit, compile, debug and release from Qt Creator?
    At this moment, there is no need to use the Qt library instead of the Windows one.

    Many thanks in advance,

    TOAOMatis


  • Moderators

    Run this in your project:
    @
    qmake -project
    @

    This should generate a project file for you. Don't treat this as "job done", though, you need to adjust the file to your needs. But the tedious heavy lifting will be done.



  • Thanks for your reply. I ran the command you suggested and it indeed generated the .pro file with all the cpp- and h-files that where in the directory.

    Although I'm using the MSVC2010 compiler, I get lots of compiler issues. All are type casting related.

    I have a CStringArray named m_strArray (bad choice of naming convention, but that's not the problem at the moment).
    This array is called a gazillion times in my application:
    @
    /// CStringArray of grid column data
    CStringArray m_strArray;
    /***/
    inline LONG GetAtLong(int nCol)
    {
    if( nCol < m_strArray.GetSize() )
    return atol(m_strArray.GetAt(nCol));
    return 0;
    }@

    This generates the following compiler error:
    @ACPDefines.h:283: error: C2664: 'atol' : cannot convert parameter 1 from 'const CString' to 'const char *'
    No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called@

    Are there some includes / typedefs which translates the Windows specifics to Qt specifics?


  • Moderators

    This has nothing to do with Qt... CString comes from Microsoft, not Qt Project. See "this thread":http://stackoverflow.com/questions/559483/cstring-to-char for some clues.



  • (If the project compiles with Visual Studio, and you are using the same compiler with QtCreator..)
    Probably you are missing some preprocessor definitions.
    http://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx

    In Visual Studio, project preperties, compiler section, command line, look for /D defines. (ex. /D_UNICODE /D_WIN32 /DCUSTOM_DEFINE)
    Add the missing ones to qmake project with DEFINES.
    @DEFINES += CUSTOM_DEFINE@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.