Qt World Summit: Register Today!

Error in toolchain.prf when building new project

  • I'm a new user, trying to build a new, empty project.
    Using Qt Creator 4.6.0.
    The project is a Qt Widgets Application for desktop.
    Here's an image of the kit I'm using for the build:
    0_1523939775974_Screenshot - 16-Apr-18 , 22_23_24.png
    I'm getting an error when building it, and here's an image of the error:
    0_1523939854600_Screenshot - 16-Apr-18 , 22_26_29.png
    If I use MinGW 32bit kit, it seems to work. But with MSVC2017 64bit, I'm getting the error. I have no idea what it is doing at the point of error, as I am completely new to using Qt. Any ideas on how I can get it to build without error?

  • Lifetime Qt Champion

    @glarson Can you go to "Compile Output" (tab 5 at the bottom) and copy paste the whole build log here?

  • Thanks, here is my Compile Output:

    08:21:50: Running steps for project MyTestApp...
    08:21:50: Starting: "G:\Qt\5.10.1\msvc2017_64\bin\qmake.exe" G:\documents\programming\QtTraining\MyTestApp\MyTestApp.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
    G:/Qt/5.10.1/msvc2017_64/mkspecs/features/toolchain.prf:208: Extra characters after test expression.
    Project ERROR: Compiler produced empty value for Active.
    08:21:50: The process "G:\Qt\5.10.1\msvc2017_64\bin\qmake.exe" exited with code 3.
    Error while building/deploying project MyTestApp (kit: Desktop Qt 5.10.1 MSVC2017 64bit)
    When executing step "qmake"
    08:21:50: Elapsed time: 00:00.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show the content of toolchain.prf:208 ?

  • @SGaist It won't let me upload a whole file yet, but if you look at my 2nd image above, it shows precisely where the error occurred. That is in toolchain.prf. It is calling eval($$v).

  • Lifetime Qt Champion

    Sorry, I didn't had the image when I answered.

    Looks pretty strange. Do you have Visual Studio installed in the standard location ?

    Can you modify toolchain.prf and add message("Test: $$v) before line 208 too see what might be giving that error ?

  • @SGaist I did as you said, and the message it printed was "Active code page: 65001".

    Very strange - then I recalled that some time ago I added something to my registry to set the code page of my command prompt windows to 65001:

    I had followed the instructions in this YouTube video, which had me put an autorun instruction into my registry:


    So I have just removed that item from the registry, and now the project builds and runs!

    So thank you and jsulm for your help on this. Cheers! ☕
    It was such an obscure thing.

  • Lifetime Qt Champion

    Glad you found out and thanks for sharing !

    Happy coding :)

  • I'm currently experiencing the exact same issue. Do you think the issue is somehow related the code page set?

  • @Andrew-Banson Absolutely! I was having this same problem: I even reinstalled both Visual Studio 2017 Community Edition and all of Qt, but brand new projects were unable to build, giving this output:

    Running Windows Runtime device detection.
    No winrtrunner.exe found.
    C:/Qt/5.11.1/msvc2017_64/mkspecs/features/toolchain.prf(208): Extra characters after test expression.
    Project ERROR: Compiler produced empty value for Active.
    C:/Qt/5.11.1/msvc2017_64/mkspecs/features/toolchain.prf(208): Extra characters after test expression.
    Error while parsing file C:\Users\gkistner\Documents\FooBar\FooBar.pro. Giving up.

    I had recently added an Autorun registry key with the value chcp 65001 in an attempt to fix cmd.exe's broken Unicode. As soon as I removed this registry key, I was able to build and run projects in Qt Creator.

    @glarson Great find, thank you!
    @SGaist Thanks for the tips that led glarson to find this. Based on the error messages, I never would have found the problem without this post.

    Note: Instead of removing the chcp 65001 Unicode code page hack, you can modify it to emit no output text by instead using @chcp 65001>nul. This fixes Qt Creator's fragile parsing, while retaining a slightly better cmd.exe unicode experience. :p

Log in to reply