Unsolved The .pro file "thefilename.pro" 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 "may12trial2.pro" 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 guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = May12trial2
TEMPLATE = appSOURCES += main.cpp
mainwindow.cpp
mar11_5.cHEADERS += 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) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}MainWindow::~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); proc->waitForFinished();
//QString output(proc->readAllStandardOutput());
QStringList list = output.split("-"); ui->lineEdit_2->setText(QString(list[1]));
}
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;
w.show();return a.exec();
}
If I'm missing any header too, please let me know. I have included a C file in my project.
-
Hi
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 ?
-
Shouldn't it be
SOURCES += main.cpp \ mainwindow.cpp \ mar11_5.c
instead of
SOURCES += main.cpp mainwindow.cpp mar11_5.c
or are the " \ " cut off here for any reason?
-
@the_
yes it should but without code tags it eats them :) -
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?
-
@anadimisra27
hi
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.