ifYouGetCompileErrorHereYouUseWrongQt



  • I have a project in VS2015 using the VS2013 compiler. I installed 4 versions of Qt and copied the msvc folders into one place. So my paths are like:
    c:\Qt\Qt5.6.0\5.6\msvc2013
    c:\Qt\Qt5.6.0\5.6\msvc2013_64
    c:\Qt\Qt5.6.0\5.6\msvc2015
    c:\Qt\Qt5.6.0\5.6\msvc2015_64

    When I compile the project for x86 everything is fine. When I compile it for x64 I get the compile error: QEventSizeOfChecker<20>::QEventSizeOfChecker': cannot access private member declared in class 'QEventSizeOfChecker<20>'. When I go to that location I see that the error is in a function called "inline void ifYouGetCompileErrorHereYouUseWrongQt()". The file where that function is is in c:\Qt\Qt5.6.0\5.6\msvc2013_64\include\QtTest. Hence, it does pick up the right path.

    Why does it complain that I am not using the correct Qt? What exactly does that mean anyways? Is the bitness wrong? The platform (VS13 vs VS15)? I was able to compile this before but unfortunately I don't recall all the things that changed in between.


  • Moderators

    @qt27

    Not sure if I got it correct.

    You are using VS2015 as an IDE, but you are using the compiler of VS2013 from within VS2015?
    By long tradition each version of MSVC has a different bit structure and you cannot mix objects compiled with VS2015 and objects compiled with 2013.

    The question is how you make the distinction between the different compiler versions?
    You are relating above only to the precompiled versions of Qt libs.

    Another problem could be that there adaptation in the different Qt tools during installation. At least this was with previous versions. Therefore a simply copy could invalidate your Qt libs version because the associated tools are not fitting anymore. No clue, if this could be still a problem.



  • Thanks for the input. I have both Visual Studio 2013 and 2015 installed on my computer. I started the project with VS2015. I then had to add some libraries that were only available as binaries compiled with VS2013. Because of that, I changed the platform toolset to VS2013 but stayed in VS2015. This is something that is changed in the properties of the various projects of my solution.

    I am not quite understanding the last paragraph you wrote. Can you please elaborate a bit more?

    FYI, in Qt project settings I have all four versions registered, i.e. they show up as msvc2013_32, msvc2013_64, msvc2015_32 and msvc2015_64. I made sure that for all the projects the defaults are correctly set, i.e. when compiling for x86 it's set to msvc2013_32 and when compiling for x64 it's set to msvc2013_64.


  • Lifetime Qt Champion

    Hi,

    How did you install these different versions of Qt ?


  • Moderators

    @qt27

    If you are still using VS2015 as an IDE, I have my doubts if this is possible. However, the time I had been using VS is already far distant.
    I have changed to Qt creator as an IDE.

    The last paragraph relates to the issue that some path values are fix in the tools such as qmake.exe and also the moc stuff and others. There had been at least in the past a tool been called during the installation process. This tool was simply replacing the standard path values with the actual values from the actual installation. This had quite some limitations (e.g. the new path had to no longer than the reserved value and more).
    Overall it was a bit of an awkward thing and I do not know if this is still the case.
    Anyhow, if it is still the case moving the installation folder will result in inconsistent setups which are not really usable.



  • @SGaist said in ifYouGetCompileErrorHereYouUseWrongQt:

    Hi,

    How did you install these different versions of Qt ?

    I don't quite recall as it's a while ago. I do remember that it wasn't clear to me how to do it. I believe I ended up installing it in different directories (not c:\qt) and then copying the msvc folder to the directory I mentioned in my initial post. I also had to edit my project file to read ...Qt5Version_x0020_Win32="msvc2013_32" Qt5Version_x0020_x64="msvc2013_64"... as the second part was missing. All of this did work before, i.e. I could compile in 32-bit and 64-bit but something must have changed.

    Btw, that function I mentioned is in a "#ifndef QTEST_NO_SIZEOF_CHECK". So QTEST_NO_SIZEOF_CHECK isn't defined. Where/when would this normally be defined? I neither could find anything on google (except for that header file that has that function) nor ANY file (.) in the c:\qt directory that contains QTEST_NO_SIZEOF_CHECK.



  • As an update, I did download the following again: http://download.qt.io/official_releases/qt/5.6/5.6.0/qt-opensource-windows-x86-msvc2013_64-5.6.0.exe

    I then installed it with all the defaults and adjusted the paths in the Qt settings of Visual Studio. Here are a few outputs from the compiler:

    QTDIR = C:\Qt\Qt5.6.0_VS2013_x64\5.6\msvc2013_64
    LocalDebuggerEnvironment = PATH=C:\Qt\Qt5.6.0_VS2013_x64\5.6\msvc2013_64\bin
    C:\Qt\Qt5.6.0_VS2013_x64\5.6\msvc2013_64\lib
    C:\Qt\Qt5.6.0_VS2013_x64\5.6\msvc2013_64\include
    C:\Qt\Qt5.6.0_VS2013_x64\5.6\msvc2013_64\bin\moc.exe

    So it picks up all the right paths. However, I am still getting that same error.


  • Moderators

    @qt27 Copying Qt installation directories is a bad idea. Just use Qt Online Installer and install all needed Qt versions. They will coexists on your hard disk without any issues, and there is no need to copy them around :-)


  • Moderators

    @koahnig said in ifYouGetCompileErrorHereYouUseWrongQt:

    If you are still using VS2015 as an IDE, I have my doubts if this is possible.

    It is possible. I don't know from which version on (i guess VS2010?) though.
    VS detects older toolkits and it can be changed in the project settings.


  • Moderators

    @raven-worx

    Thanks for correcting my view. I havve stopped using VS before that. Propably MS saw a need with their frequent version changes.


Log in to reply
 

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