Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Cannot write to file: Unknown error after clean install of Qt



  • I am using Qt Open Source and the default installer. I am trying to install the latest version and every time, the installer says it installed successfully without any errors but when I launch Qt Creator, I get this error:
    Image of the error

    This error pops up in some random places. When I try to create a new project it appears. Sometimes I get this error:
    Image of second error

    What I have tried:
    I already reinstalled 3 times. I used Revo-Uninstaller and cleaned up registry and other file references.
    I gave full permissions to my AppData folder and all folders/files inside.
    I tried running the installer with Admin privileges twice. I also gave full permissions to any other folders I thought Qt would use. (ProgramData, C:\Qt)
    I added C:\Qt\Tools\QtCreator\bin and C:\Qt\Tools\QtCreator\bin to my system's paths.

    Other errors I get is just plain freezes/crashes when clicking buttons or trying to open projects. I have no idea what's going on and why it's not working, let me know if you need other info from me.
    I would like to get Qt up an running soon hopefully, but I don't know how to fix whatever is wrong with it. Thanks for your help in advance.

    (I am also running this on my Windows 10 Pro laptop)



  • @johnratius
    I would concentrate just on the path it reports. Have you tried, outside of Creator, to create exactly that file successfully?



  • @JonB
    That file already exists. I checked it's permissions and the system and user has full access to that file. I uploaded the contents of the file here: toolchains.xml
    I am not sure what's wrong with my computer or installation.



  • You could try creating a new user in your Windows 10, log out and log in as that new user and start Qt Creator.
    (Note: this is a just a guess :-)



  • @hskoglund
    I tried a new user and it installed and runs correctly. Since I installed it to the C:\ directory, I tried running it on my normal account and I continue to get the errors. Any suggestions?



  • The easiest is just to nuke the whole directory C:\Users\John\AppData\Roaming\QtProject
    (equivalent to creating a new user in Windows 10 from Qt Creator's point of view)

    Note: perhaps zip the directory first in case there are some settings you want to resurrect from the nuking



  • I tried that before and I kept getting the error. I ended up just reinstalling windows for a clean installation. It now works fine.



  • Reinstalling Windows was a temporary fix. I installed all my regular programs back and tried to run Qt Creator and got the same errors.


  • Lifetime Qt Champion

    @johnratius said in Cannot write to file: Unknown error after clean install of Qt:

    regular programs

    Hi does these regular programs include any kind of anti virus software ?



  • @mrjj Only Malwarebytes. But I have already disabled it and tried running it before and the issue still arises. When Qt Creator ran successfully after my clean Windows re-install, Malwarebytes was already installed. Since then, other software such as Microsoft Visual C++ Redistributables were installed as well as OBS, Git, MS Office, music software, etc... I even disabled windows Firewall and still got the errors. I don't think it's an anti-virus problem...

    I should add, though I have not used Qt Creator much and I used to program Qt in other IDEs, when creating a project now, all Qt includes are not recognized or not found. In any new or old project. I have no idea why Qt Creator can't read the path to bin. (adding to path to system variables has not worked, though I have not tried adding every bin directory, just the ones I use)

    I found these:
    https://stackoverflow.com/questions/7530111/qt-creator-cannot-create-file-qtcreator-xml-mac/8820193
    https://askubuntu.com/questions/253785/cannot-overwrite-file-home-baadshah-config-qtproject-qtcreator-toolchains-xml

    but I am not familiar enough with Linux to translate these commands over to test them. I also installed Qt with all the correct permissions I thought it needed which worked for a little while.



  • Would it be possible that other software on my computer conflicts with Qt?


  • Lifetime Qt Champion

    @johnratius
    Hi
    yes but its normal scanner software or other file checkers as Creator has its on profile etc so
    not sure how another app could prevent it from writing etc.

    Also it worked when windows was more clean and then it stopped so it does seems like something you installed after does something but I have no guesses.



  • So after many days weeks of checking each program I install after a reset, I found the perpetrator.

    I have a bin directory in my C drive containing a script with a bunch of doskey commands so I can use common bash commands.

    Upon adding this script with my registry script:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor]
    "AutoRun"=hex(2):43,00,3a,00,5c,00,62,00,69,00,6e,00,5c,00,73,00,74,00,61,00,\
      72,00,74,00,75,00,70,00,2e,00,62,00,61,00,74,00,00,00
    

    Qt Creator throws this error.

    What the above script does is this and only this:

    registry editor pic
    Makes sure the Command Processor folder is there, adds an AutoRun REG_EXPAND_SZ with the value to my script C:\bin\startup.bat

    From what I remember, I can do this manually and Qt still crashes on start.

    I do love my bash commands and would like to have them with Qt Creator. Is this a bug? If there is a workaround, that would be amazing.

    Time to restore my computer to before I installed the script sigh...



  • Hi, I think the culprit might be one of the bash commands in that startup.bat file causing a name collision.
    First guess would be: is one of those bash commands called toolchains?



  • That would be my guess too but no. This is all I have in my bash commands.

    @echo off
    cls
    doskey ls=dir /W $*
    doskey touch=copy NUL $* 1>NUL
    doskey up=cd.. $*
    doskey ip=ipconfig $*
    doskey rm=del /Q /F $* > NUL
    doskey rmd=rmdir /Q /S $*
    doskey clear=cls
    cls
    

    Note: This the above runs whenever I start a CMD window the way the registry script is installed.



  • I installed Qt 6.0.0 today and I'm getting the same error on every startup of Qt Creator 4.14.0.
    There was Qt 5.15 with a previous version of QtCreator installed, which I removed before.
    Deleting the complete directory \users...\QtProject did not help.

    I don't have a script like @johnratius nor a registry entry like this.
    But I found a similar report for a ubuntu environment here:

    https://bugreports.qt.io/browse/QTCREATORBUG-20880

    The conclusion there is that some third party library has an influence.


Log in to reply