Important: Please read the Qt Code of Conduct -

The .pro file "" could not be parsed

  • Hello! I'm trying to build a GUI for my C Code using Qt. The code is building properly and there are no compilation errors (at least not shown). The problem is that the run button is grey and hence I'm not able to run the code. When I hover over it, it displays the message "the .pro file "" could not be parsed"
    What could be the problem? I'm new to Qt, just 2 days including today. Help will be appreciated.

    Here is my .pro code;
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = May12trial2
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    Here is the mainwindow.cpp code:
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QRegExp>
    #include <QString>
    #include <QStringList>
    #include <QProcess>
    #include <QByteArray>
    #include <QLineEdit>

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;

    void MainWindow::on_pushButton_clicked()

    QString str1,str2, output;
    str1 = ui->lineEdit->text();
    str2 = ui->lineEdit_3->text();
    QStringList params;
    params << str1 << str2 << output ;
    QProcess *proc;
    proc->start("./mar11_5.exe", params);

    //QString output(proc->readAllStandardOutput());

    QStringList list = output.split("-");


    Here is the main.cpp code:
    #include "mainwindow.h"
    #include <QApplication>
    #include <iostream>
    #include <stdlib.h>

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    MainWindow w;;

    return a.exec();


    If I'm missing any header too, please let me know. I have included a C file in my project.

  • Lifetime Qt Champion

    Try to run qmake from build menu
    If pro file is not correct it should show error.

    Also, try make a new default project with New and see if that just runs ?

  • @mrjj

    Shouldn't it be

    SOURCES += main.cpp \
    mainwindow.cpp \

    instead of

    SOURCES += main.cpp

    or are the " \ " cut off here for any reason?

  • Lifetime Qt Champion

    yes it should but without code tags it eats them :)

  • @mrjj

    ah ok

  • @mrjj Hello! I did : Run qmake from the build. Still no errors. I also ran a new project, that is working. (just a basic one where if you click a button text gets printed in the line edit).

    In the code that I have written, do I need to include some additional header files or add some code when I'm adding a .c file to my project?

  • Lifetime Qt Champion

    no, u can just copy the .c file to the project folder. Then right click project and select
    Add existing file and point to your .c file.

Log in to reply