Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Steven Friedrich on March 04, 2022, 01:46:59 am

Title: Can I replace Hello world boilerplate code with my own boilerplate?
Post by: Steven Friedrich on March 04, 2022, 01:46:59 am
When I create a new project, CB automagicallly includes a main.c with Hello world.
Is this specified in Settings somewhere?  I can't find it.  I would like to configure CB to use my own template.c, template.h, or template++.cpp, template++.h.
Title: Re: Can I replace Hello world boilerplate code with my own boilerplate?
Post by: Pecan on March 04, 2022, 01:56:09 am
You can right-click on any file in the project tree and chose "Remove file from project".

Then you can right-click on the project and choose "Add files" to add what files you like to the project.
Title: Re: Can I replace Hello world boilerplate code with my own boilerplate?
Post by: Steven Friedrich on March 04, 2022, 02:17:48 am
Thanks for your reply.  I have done that, but I would really like to make it automagic.
Title: Re: Can I replace Hello world boilerplate code with my own boilerplate?
Post by: Pecan on March 04, 2022, 06:44:29 am
Once you have added the files you like, you can save the project as a template. Menu->File->Save project as template.

Then when you want to create your new project, choose your template instead of one of the CB basic projects from the Menu->File->New->From template.
Title: SOLVED Re: Can I replace Hello world boilerplate code with my own boilerplate?
Post by: Steven Friedrich on March 04, 2022, 02:38:26 pm
Thanks.  That works exactly as I hoped.