User forums > Using Code::Blocks
Removing Hello World default text
wolfcry:
Hello,
I asked this in an earlier thread but the question hasn't been answered yet and I can't find the solution anywhere. Not in the wiki nor on this site so I was hoping someone would be able to direct me.
Everytime I open a new file / project, the hello world is statement is already there in the template. I want to remove that but don't know where to do this.
Thank you.
Jenna:
Sorry, but your questions sounds like you do not know how to remove text from a file.
I can not believe, that it is what you mean, so my question: do you want the template being created with empty main.cpp ?
If yes, you can just create a new project with the wizard, fix everything as you like it for your default project and saev it as user-template ("File -> Save project as template").
To use the template chose: "File -> New -> From template..."
wolfcry:
Hi jens,
Sorry, I didn't realize that's how the question was making it seem. I definitely could have reworded the way I asked lol. That's funny. I better know how to remove text from a file lol.
Yes, removing the default 'hello world' text from the template itself is what I meant. Ok, now while what you suggest will work and I have taken your advice and created my user template, however, I was hoping to be able to edit the template C::B uses during project creation.
The reason being, when creating a new project using the user template, I have to search for and locate the directory / folder that I'm using in order to create the new project files themselves and I don't want to have to keep doing this. I work on different projects at a time and frequently have to create new projects so this isn't optimal for me.
Thank you for your help.
wolfcry:
I'm still having difficulty getting rid of the inserted "hello world" text from appearing in the main.cpp source file that C::B creates when you create a new project.
I do not want to have to use a user template because I'm forced to search and locate the directories I store C++ projects, then create a new folder (which I then have to rename manually), then create a name for the project every time I want to use a user based template.
These are all unnecessary steps that are extremely annoying and time consuming as the day moves on and as new projects need to be built.
This is what I want to happen:
1. start new project
2. click on console application
3. select C++
4. go through steps of console application wizard.
5. When the project is successfully built via the wizard, click on the sources folder, open up the main.cpp file and NOT have this included into the file:
--- Code: ---cout << "Hello world!" << endl;
--- End code ---
I've read through the manual, searched this site, the wiki site, explored the tools and options in the C::B application itself, tried right-clicking on the console application icon to edit the template, as well as the files listed under "Files" in the wizard, and I still cannot find that text. I even tried finding the template that is used by searching the programs installation folders and nothing.
How do I remove that text?
codie:
Whether its the right way or not, I rid any new C++ console main.cpp files of the Hello World stuff by editing the file in this directory:
C:\program files\codeblocks\share\codeblocks\templates\wizard\console\cpp\main.cpp
the wizard grabs this file so now I have a starter main.cpp with any comments, includes or whatever I want to start with.
right or wrong that worked for me ... it appears all the wizard starter files are in that path
Navigation
[0] Message Index
[#] Next page
Go to full version