Author Topic: Learning C++ Main.cpp  (Read 14364 times)

superjacent

  • Guest
Learning C++ Main.cpp
« on: March 09, 2005, 11:55:41 pm »
Hope this is the right forum.

I'm learning C++ and looking at a few ide's.   I'm typing numerous examples from a book, all simple stuff.   My question is, I can't seem to change the filename "main.cpp".   Is it the case that for each new program (or Hello World type example) they have to be in their own directory.   They are only simple console apps.   All this simple stuff I'm just wanting to keep them contained in the one directory (my directories for training purposes named Chapter01, 02 etc.)

Any help would be appreciated.

Steven Taylor
Melbourne, Australia.

mike

  • Guest
Learning C++ Main.cpp
« Reply #1 on: March 10, 2005, 02:59:57 pm »
I didn't really follow your question, but if all your files (for some reason) must be called "main.cpp", then obviously you shall spread them into different directories. It is probably easier, though, to call them "lesson01.cpp", "lesson02.cpp", etc.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Learning C++ Main.cpp
« Reply #2 on: March 10, 2005, 03:58:16 pm »
I guess superjacent meant that when he creates a new project (from the templates), it always contains a file called main.cpp. This is designed like that because, usually, each project lives in its own folder.

The only workaround is to create a new empty project and then create a new file with the name you choose and add it to the project. Just remember to go to project properties and change its type to console application (IIRC defaults to GUI application).

HTH,
Yiannis.
Be patient!
This bug will be fixed soon...

Anonymous

  • Guest
Learning C++ Main.cpp
« Reply #3 on: March 26, 2005, 12:20:33 pm »
When you create a new project using templates, at least one starter file will be auto created.  Just remove these file(s) using the "Project" menu and then remove them physically from disk.  Add your files to the project and then save it once and you are done.

Anonymous

  • Guest
Learning C++ Main.cpp
« Reply #4 on: March 26, 2005, 02:25:15 pm »
Quote from: Anonymous
When you create a new project using templates, at least one starter file will be auto created.  Just remove these file(s) using the "Project" menu and then remove them physically from disk.  Add your files to the project and then save it once and you are done.
Thanks all.