porting a project from Eclipse to QtCreator causes mysterious errors



  • hi,
    I want to transfer a Qt-project from Eclipse CDT Helios, Qt Integration, on Linux to QtCreator on Win 7. With Eclipse the project builds without any errors. With QtCreator there are errors like e.g.:

    Code --> errormessage
    #define ULONG unsigned long --> duplicate 'unsigned'
    #define FLOAT float --> multiple types in one declaration
    #define INT short int --> multiple types in one declaration

    There are many more errors. But these errors with the #defines I do not understand at all.

    Has somebody an idea what could be wrong here?



  • Hi and welcome to devnet?

    both Eclipse and Qt Creator are configured to use the same compiler??

    Do you used Eclipse to build also on Windows??



  • Eclipse is used only on Linux. Eclipse uses gcc.

    I guess, Qt Creator uses MinGW. For the installation of Qt Creator I selected the MinGW version. But in the configuration settings (Einstellungen) for the compiler MinGW and MS Visual C++ are shown - "automatically selected".

    Meantimes most of the errors are eliminated. The problem was that many of my '#defines' used names which are also defined in minwindef.h, and minwindef.h seems to be included by some Qt Creator programs.

    There is one remaining problem:
    '#define DOUBLE double ' results in the error 'multiple types in one declaration'. But DOUBLE is not defined in minwindef.h.

    When I have found the final solution I will mark this topic als solved and describe the solution. Hopefully I will find it :-(



  • Hi,

    the problem is not related to the IDE but to the compiler.
    It fails to build if you use both compilers (MinGW and Visual C++)??



  • I am not sure about the compilers.

    In Eclipse I saw 'gcc' in the properties.
    And for Qt Creator I selected the MinGW version. So hopefully Qt Creator uses MinGW.
    In an early try I had installed the MS Visual C++ version of Qt Creator. But then there were many more errors. Therefore I chose the MinGW version.



  • Just to clarify: Qt Creator is an IDE and is independent from the compiler; the Qt version to choose depends to the compiler



  • I doubt that it is the compiler.
    A compiler just compiles what it is told to.
    The IDE tells the compiler what to compile.

    Most problems came up because anywhere - I don't know where - the header file minwindef.h has been included. For sure, nowhere in my project this file is included. I did not know it at all. So it must have been the IDE which included it for any purpose.
    I guess that it is the different Qt version. On Linux (Eclipse) it is Qt 4.7 and on win7 (Qt Creator) it is Qt 5.3.



  • @qtNiko said:

    I doubt that it is the compiler.
    A compiler just compiles what it is told to.
    The IDE tells the compiler what to compile.

    Not true! Qt Creator is simply a IDE: it runs qmake and then make (no magic stuff).
    The build process of Qt projects is controlled by qmake that is a tool independent by IDE

    Most problems came up because anywhere - I don't know where - the header file minwindef.h has been included. For sure, nowhere in my project this file is included. I did not know it at all. So it must have been the IDE which included it for any purpose.

    minwindef.h is part of MinGW header files

    I guess that it is the different Qt version. On Linux (Eclipse) it is Qt 4.7 and on win7 (Qt Creator) it is Qt 5.3.

    You can simply build your project manually on both platform running:

    1. qmake <project_file>.pro
    2. make

    both Eclipse and Qt Creator run the same sequence when you build a Qt project.



  • You've changed, platforms (Linux to Windows), IDE (Eclipse to Qt Creator), compiler (gcc to mingw), and Qt version (Qt4.7 to Qt 5.3). Running qmake with a different spec file (determined by your platform and compiler) can affect the compiler options and includes. Have you read the Qt4 to Qt5 porting guide?


Log in to reply
 

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