PDA

View Full Version : main.cpp in creating new QWidget project



iamDAMON
1st October 2012, 07:52
Hi Guys!

I'm a little bit confused about this one. Can someone explain to me what is the main purpose of the automatically generated main.cpp when creating new QWidget project? Can I delete the main.cpp file? Or i need some modifications first before deleting the main.cpp?

Thanks in advance guys! I'm new in Qt!

This is the structure:

-Trial.cpp
-Main.cpp

-Trial.h

-Trial.ui

ChrisW67
1st October 2012, 09:28
The main purpose of the code in main.cpp, which is just a main() function, is exactly the same as the main() function in any C++ program: its the starting point for running your program.

d_stranz
1st October 2012, 21:20
Can I delete the main.cpp file?

You can delete the main.cpp file but, as ChrisW67 said, you can't delete the main() function. That's the entry point to your program. You can move that function to another file (like Trial.cpp), but it has to be somewhere and it has to have the name main() with the correct arguments and return value.