User forums > Using Code::Blocks

Cannot change default source code when opening new console application

(1/2) > >>

sonicstrav:
This comes up all the time:

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

I've changed the code under Setting>Editor>Default Code>C/C++ Source file and saved it but with a new project selecting a console app the same old 'Hello World!' stuff comes up again

How can I change the default code for this?

oBFusCATed:
File -> New -> Project -> right click on the template you want to modify -> Edit script....

sonicstrav:
Hmm.....the above code doesn't appear in the script (when right-clicking on console application)  :?

Jenna:
The place for the template depends on your OS, but it seems you believe we hav the second sight.

stahta01:

--- Quote from: sonicstrav on June 20, 2010, 08:32:17 pm ---Hmm.....the above code doesn't appear in the script (when right-clicking on console application)  :?

--- End quote ---

Failed for me, also. Looks like Windows 7 security redesign type issue. I am using Windows 6.1 32 bit AKA Windows 7.
Looks like it was user error on my part; it works but not like I think it should; I never found a way to edit the c/cpp source code file thou the GUI.


The folder containing source code file to be edited on my machine:

 

My best guess on the files to edit are:
console.cbp
console.template
console-main-c.cpp
console-main-cpp.cpp

Destination under Windows 7 of modified files should be
(The folder is create/updated when the GUI is used to edit the script)


--- Code: ---%APPDATA%\codeblocks\share\codeblocks\templates\wizard\console

--- End code ---

I copied the missing files from

--- Code: ---%ProgramFiles%\CodeBlocks\share\CodeBlocks\templates\wizard\console

--- End code ---

The I edited the main.cpp file in the "cpp" folder. I then started Code::Blocks and it worked for me.

Tim S.


Navigation

[0] Message Index

[#] Next page

Go to full version