PDA

View Full Version : How to convert the project in Qt creator to a single c/cpp file?



Kiran_Thomas
16th March 2013, 07:14
Hi,
I want to know if its possible to make my project created through Qt creator into a single file and if so how do i go about it? I have seen examples like
[code]#include <QApplication>
#include <QPushButton>

int main(int argc, char** argv) {
QApplication app(argc, argv);

QPushButton btn("Hello World");
btn.show();
btn.showMaximized();

return app.exec();
}
When creating a project using the creator we get a main.cpp, mainwindow.cpp, mainwindow.h, etc. right? How can I include all of these into a single main.cpp like the code shown and then use qmake and make from the terminal for executing?
Any help is appreciated...
Regards,
Kiran

wysota
16th March 2013, 08:48
It is possible but for a larger project I don't see any reason to do that. If you really want to then copy all content to a single file, add a #include "main.moc" statement just before the main function or at the end of the file, run qmake and build the project.