Author Topic: [SOLVED] Project Template  (Read 162 times)

Offline fmc0501

  • Multiple posting newcomer
  • *
  • Posts: 14
[SOLVED] Project Template
« on: April 04, 2020, 08:05:28 pm »
I'm taking a C++ class on Udemy. Like all the other places that teach "Beginner" C++, everything is done with Console Appliactions. In each class Section, there are multiple projects. So I'm opening several Projects in the Workspace. And in each one of them, I have to remove
Code: [Select]
using namespace std; and
Code: [Select]
cout << "Hello world!" << endl; How can I make a template without these two lines when I start a new Project?

I've already tried this. But when I tried to save it in the Section folder the other section projects were in, it warned me that the files in that folder would be deleted if I finished the action. So I don't know how to call it on this one. But there has to be a way to rid the main.cpp of those two statements.
« Last Edit: April 04, 2020, 09:29:51 pm by fmc0501 »
Linux Mint 19.3
gcc version 7.5.0 / Target: x86_64-linux-gnu
Code::Blocks : svn-r0 / SDK Version : 2.2.0

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12600
    • Travis build status
Re: Project Template
« Reply #1 on: April 04, 2020, 08:13:18 pm »
You can edit the sample.cpp file in the template folder of your installation. Or make your custom console project template. The template is a simple squirrel script, so you could modify it as you like.

See here http://wiki.codeblocks.org/index.php/Scripting_Code::Blocks
And more specifically here: http://wiki.codeblocks.org/index.php/Wizard_scripts
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline fmc0501

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Project Template
« Reply #2 on: April 04, 2020, 09:29:27 pm »
That got it, oBFusCATed. I appreciate you. Thanks.
Linux Mint 19.3
gcc version 7.5.0 / Target: x86_64-linux-gnu
Code::Blocks : svn-r0 / SDK Version : 2.2.0