Author Topic: main.cpp  (Read 6903 times)

Offline tm2383

  • Single posting newcomer
  • *
  • Posts: 4
main.cpp
« 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
   

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: main.cpp
« Reply #1 on: September 23, 2009, 11:30:26 pm »
What kind of project have you made?
Do you click on the checkbox -> empty project?
(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 tm2383

  • Single posting newcomer
  • *
  • Posts: 4
Re: main.cpp
« Reply #2 on: September 23, 2009, 11:38:45 pm »
Sorry, should have said!  It was a console application.

Thanks,
tim

zabzonk

  • Guest
Re: main.cpp
« Reply #3 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.




Offline tm2383

  • Single posting newcomer
  • *
  • Posts: 4
Re: main.cpp
« Reply #4 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
 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: main.cpp
« Reply #5 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.
(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 tm2383

  • Single posting newcomer
  • *
  • Posts: 4
Re: main.cpp
« Reply #6 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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: main.cpp
« Reply #7 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.

zabzonk

  • Guest
Re: main.cpp
« Reply #8 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.