0

I'm simply looking for a quick and easy solution on how to change the default source code (if at all possible) for when you open a qtCreator C++ project.

As soon as you open up a new project you see something like below in your main.cpp file.

#include <QCoreApplication>

int main(int argc, char *argv[]) {
    QCoreApplication a(argc, argv);

    return a.exec(); }

I'm wondering if there's a way to change this code snippet to user defined code. I personally just think its a hassle to wipe all this code out every time I create a project and would rather it look something like below, when I make a new project.

#include <QCoreApplication>
#include <iostream>

using namespace std;

int main() {

}

Anyways, open to all different types of solutions just let me know...

Botoq
  • 21
  • 2
  • I guess that's the standard way of writing a main function for a QT application which is fine. I still don't get it why you want to change it. Plus, `using namespace std;` in the global scope is a sin. – digito_evo Aug 26 '22 at 06:50
  • Don't judge- using namespace std; globally is standard practice for my community college classes so I haven't tried other stuff. Essentially still just looking for a way to change that default code though. – Botoq Aug 26 '22 at 22:01
  • You mean in 90% of the universities/colleges of the world? Yes, that's true. But that still doesn't change the fact that it's a very flawed practice. See [Why is "using namespace std;" considered bad practice?](https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice) – digito_evo Aug 26 '22 at 22:06

0 Answers0