Author Topic: Using Code Blocks for learning C++  (Read 6788 times)

Offline MitalSM

  • Single posting newcomer
  • *
  • Posts: 2
Using Code Blocks for learning C++
« on: February 10, 2014, 09:35:57 am »
Hello All,

I am learning C++. Not for the first time but after a long hiatus.

I installed Code Blocks for running some sample programs for learning.

I wanted to know that every project that i create has a single main.cpp file. Now my question is do i need to create a new project every time when i need to create a new program. or can we just add new files into the same project and also change the main program.


Offline thor36

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: Using Code Blocks for learning C++
« Reply #1 on: February 10, 2014, 01:19:46 pm »
Hi , welcome to Code Blocks and to C++ again  ;D I have been using Code Blocks to learn C++ as well, and I can only give compliments !

Yes, everytime you want to create a new program, you need to create a new project. You can also add source files to your project to expand your program of course, but it will still be one program.

I think I know what you have in mind, because I had a similar question when I started learning C++ on Code Blocks. I solved it by creating one project ( with 1 main.cpp of course ). This main.cpp was an entry point to a console application, where I selected many programs with using switch-case statement. So... The console gave me a list of topics ( say, 1. variables 2. arithmetic operations 3. flow control 4. pointers etc... ). Then I chose the topic I wanted to study / edit by pressing the corresponding number, and that sub-program was actually its own .cpp file with a function in it ( variables.cpp, pointers.cpp etc... ). I hope that gives you some idea of what you can do  :)
« Last Edit: February 10, 2014, 01:21:25 pm by thor36 »

Offline MitalSM

  • Single posting newcomer
  • *
  • Posts: 2
Re: Using Code Blocks for learning C++
« Reply #2 on: February 12, 2014, 08:17:43 am »
Yes it does help thor  :)

Thanks for this reply.

I have now gotten used to creating a new project every time i want to try something new. Its fun learning things after a long time. Trying to make the best of this!  8)  ;D

Offline thor36

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: Using Code Blocks for learning C++
« Reply #3 on: February 12, 2014, 03:55:49 pm »
Great, I'm glad to hear it.
I took your steps not too long ago, so I know the fun you are talking about  ;D 

If you need more help with that kind of questions,... I have the basics. But in any case, guys on this forum are great and you don't need to keep your Code::Blocks problems to yourself  ;D Cheers !