Important: Please read the Qt Code of Conduct -

:-1: error: cannot open output file debug\hostname.exe: Permission denied

  • @#include <QString>
    #include <QDebug>

    int main()
    QString name = qgetenv("USER");
    if (name.isEmpty())
    name = qgetenv("USERNAME");
    qDebug() << name;
    return 0;

    I'm trying to learn getting environment variables from examples found on internet but this one seemed to have permission related issue.

    How do I know the right permission needed to be able to get the right output?

    The project name is hostname

Log in to reply