Interesting Macro idea.

Hey, Is there any way to make a macro/template that for example when a new project is created, will automatically make a main.cpp file that is populated with things such as includes etc.Bacically I would love to make something that when i opened it the following was already populated
1
2
3
4
5
6
#include <iostream>
using namespace std;
void main()
{

}

Is this at all possible. If so, how would i go about creating this type of template/macro.
Depends on your compiler or IDE, check documentation that it comes with. But if you plan on having void main in there you deserve to be locked up.
Just save the file somewhere and either copy it to start a new project or open it and then use save as...
Thanks guys. I use visual studio btw. I was thinking about doing it the way moorecm said, but I wanted to see of any other ways.
I know C::B has project templates that you can set up. You can just design your own template and select it from the menu when you create a new project.

I'd bet VS probably has something similar. You'd have to dig around in the options somewhere -- or try right clicking in places in the new project wizard.
Ok, good idea. Thats exactly what I was going for. I wanted another type of project that I could choose which would be populated with certain routine things.
And make your template "int main()" instead, and don't ask why, just search for the gazillion threads around
here related to int main vs. void main.
Yea I would have. Ive read the reasons why. Also, I just found out the Visual studio doesnt allow for templates to be made with the C++ language. The option to make a project into a template is greayed out.
Topic archived. No new replies allowed.