Code::Blocks Forums

User forums => Help => Topic started by: tm2383 on September 23, 2009, 11:21:15 pm

Title: main.cpp
Post by: tm2383 on September 23, 2009, 11:21:15 pm
Hi,
I am fairly new to C++ programming and have just installed Code::Blocks on my computer running Ubuntu Linux 9.04. When I start a new project, I assumed that when I clicked on the source folder on the tree at the left hand side of Code::Blocks, main would appear, which I could then click on to open, but this is not the case. The source folder appears to be totally empty. Is this meant to be the case and if so, how do I create a main file?

Thanks,
Tim
   
Title: Re: main.cpp
Post by: oBFusCATed on September 23, 2009, 11:30:26 pm
What kind of project have you made?
Do you click on the checkbox -> empty project?
Title: Re: main.cpp
Post by: tm2383 on September 23, 2009, 11:38:45 pm
Sorry, should have said!  It was a console application.

Thanks,
tim
Title: Re: main.cpp
Post by: zabzonk on September 24, 2009, 12:02:39 am
If yous start CB and do:

File|New|Project..

then select:

Console application

then hit Go, and select C++ and then Next, you should get the Console application dialog. This is very far from being a great example of the GUI designer's art, but if you enter "xxx" (no spaces or anything ambitious) in the Project Title field (it of course is not the title, but the name) ,  and then hit Next, it should create a project and main file for you somewhere - exactly where is spelled out in the "Resulting filename" field.

This dialog drives me nuts every time I use it, but it does always create a main.cpp somewhere, at least on my Windows version of CB - I don't use CB on Linux.



Title: Re: main.cpp
Post by: tm2383 on September 24, 2009, 12:13:41 am
Hi,
Thanks for the reply. If I navigate to the folder containing the new project,  I see the main.cpp file, but can't seem to add it to the codeblocks tree. When using Codeblocks on Windows, when I click the source folder folder on the menu tree, main drops down, which can then be clicked on to open it.

tim
 
Title: Re: main.cpp
Post by: oBFusCATed on September 24, 2009, 12:26:34 am
What is your CB version?

Is there a ">" arrow next to the "Sources" item in the tree?
If yes click it. If no, open the *.cbp file with a text editor and try to find the "main.cpp" file.
Title: Re: main.cpp
Post by: tm2383 on September 24, 2009, 12:31:40 am
Problem solved!!! I was clicking on the folder itself (which works on Windows) I didn't realise the '>' were clickable.

Thanks for the help,

Tim
Title: Re: main.cpp
Post by: Jenna on September 24, 2009, 06:21:16 am
Works for me exactly the same way on vista and linux: doubleclick on folder-name or icon toggles it, single-click on the +/- (windows) or the triangle (linux) opens or closes it (depending on the state.
On w2k the double-click seems not to work.
Title: Re: main.cpp
Post by: zabzonk on September 24, 2009, 10:36:09 am
> On w2k the double-click seems not to work.

Double-click works for me on W2K SP4, using CB build SVN 5678.