Author Topic: New beginner's question about projects and small programs! Please help!  (Read 7420 times)

nilsh

  • Guest
Hello! I am writing this, because I have a little sorting problem.

Well, I am very new to C++, and I am following some examples from a book, with mostly "Hello, World!" programs. I need to program all of these to even get to a somewhat basic level, but it's kinda hard for me, because I have this problem with Code::Blocks.

My question is: How do I get to program many small programs in the same project? They can't all be named main.cpp right? And how do I even create one? I tried "new file" but didn't get the hang of it. I would really appriciate if someone would help me sort this problem out.
Do I need to create a new project for every single program I make?

Thanks in advance

-nilsh

Offline BCCISProf

  • Multiple posting newcomer
  • *
  • Posts: 60
    • Professor Langsam's Home Page
Re: New beginner's question about projects and small programs! Please help!
« Reply #1 on: February 03, 2008, 01:28:06 am »
Each project is supposed to contain one independent program. Although a project can contain many source files, there can only be one main() per project.

More than likely as a new beginner, you are working on programs which consist of only one source file. In that case each program will be a separate project.

As you advance, you will learn how to write programs which consist of multiple source files. There will still be only one main() per project.

A introductory manual to CodeBlocks can be found here: http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New beginner's question about projects and small programs! Please help!
« Reply #2 on: February 03, 2008, 08:51:17 am »
there can only be one main() per project.
That is not correct. A project can have 1..n targets. Each target can have one main() (if you like to call it that way). Notice that a target does not require to be an application at all. It can also be a library or just a script or even just a collection of files without any compilation. Within a workspace you can have 1..n projects. So it's: 1 workspace with 1..n projects with 1..n targets each.
It might be interesting for you to read:
http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: New beginner's question about projects and small programs! Please help!
« Reply #3 on: February 03, 2008, 04:07:14 pm »
A introductory manual to CodeBlocks can be found here: http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf

wow! a 64 pages how to compile and debug codeblocks manual  :)

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: New beginner's question about projects and small programs! Please help!
« Reply #4 on: February 04, 2008, 11:20:29 pm »
Nice, but it seems that the source code is not available...
Looks like piracy isn't it ?

Offline BCCISProf

  • Multiple posting newcomer
  • *
  • Posts: 60
    • Professor Langsam's Home Page
Re: New beginner's question about projects and small programs! Please help!
« Reply #5 on: February 05, 2008, 01:28:35 am »
Quote
That is not correct. A project can have 1..n targets. Each target can have one main() (if you like to call it that way). Notice that a target does not require to be an application at all. It can also be a library or just a script or even just a collection of files without any compilation. Within a workspace you can have 1..n projects. So it's: 1 workspace with 1..n projects with 1..n targets each.

You are quite correct. However, I was trying to describe it to someone who appears to be a student in an introductory programming class. In such a situation this simplification is probably warranted.


Offline BCCISProf

  • Multiple posting newcomer
  • *
  • Posts: 60
    • Professor Langsam's Home Page
Re: New beginner's question about projects and small programs! Please help!
« Reply #6 on: February 05, 2008, 01:31:33 am »
Nice, but it seems that the source code is not available...
Looks like piracy isn't it ?

What are you referring to? I hope not to the manual.... :) After all, I am one of the authors.....

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: New beginner's question about projects and small programs! Please help!
« Reply #7 on: February 05, 2008, 08:02:42 am »
Hi !

As I read the manual, I was curious to see what was at the adress:
http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/

And it seems setups of MinGW and Code::Blocks are available without providing the sources whereas both are under GPL.

Dje

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: New beginner's question about projects and small programs! Please help!
« Reply #8 on: February 05, 2008, 10:42:31 am »
Regarding the actual manual, it's hard to give a clear answer.
If it is (at least partially) derived from the docinfo like Mario's manual, then very strictly speaking, it falls under the GPL as derived work, and the author must publish sources (screenshots are mostly considered not to be protected by copyright, or may be defended by fair use in some countries, unless they predominantly or exclusively consist of copyrighted original artwork).

However, I generally think that in the case of documentation, a too strict interpretation of licenses such as the GPL is a bit pedantic and unsuitable.
Documentation is meant to make everyone's life happier, it helps users to understand a program, and it is very clearly beneficial to a program's acceptance (unless it's a really bad documentation). Thus, punishing people for writing documentation in obviously good faith looks a bit silly to me.

Regarding the binaries, Dje is right. The GPL does demand that you publish the sources for both MinGW and Code::Blocks if you offer downloads (a link to the source code is not enough). But no worries, the FBI won't knock down your front door during the next 8 hours, please just add the sources when you find the time.
Unluckily, it is not possible (other than by dual-licensing) to make exceptions on the source code clause for several legal reasons (which, to make it more difficult, are different in different countries, too).

If publishing the source code is a problem (due to bandwidth, or for whatever reason), it is still easy to make everyone happy by writing something like:
Download the MinGW installer: MinGW-5.1.3.exe
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline BCCISProf

  • Multiple posting newcomer
  • *
  • Posts: 60
    • Professor Langsam's Home Page
Re: New beginner's question about projects and small programs! Please help!
« Reply #9 on: February 05, 2008, 06:44:49 pm »
Quote
Regarding the actual manual, it's hard to give a clear answer.

Let me be very clear. The manual is written from scratch -- it is not a derivative work. We wrote it for our students and are glad to make it available to anyone who might find it useful. In academic circles we take the hint of plagiarism very seriously. I want to make it clear that this is an original work.

Quote
Regarding the binaries, Dje is right. The GPL does demand that you publish the sources for both MinGW and Code::Blocks if you offer downloads (a link to the source code is not enough)........

With regards to CodeBlocks and MinGW we have packaged it, with the options our students need, in what we hope is a foolproof uncomplicated installation for introductory students in computer science.

In order to comply with GPL licensing, we are happy to adopt Thomas' suggestion. Thus we have modified our page http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/ to include the source code.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New beginner's question about projects and small programs! Please help!
« Reply #10 on: February 05, 2008, 09:38:06 pm »
In order to comply with GPL licensing, we are happy to adopt Thomas' suggestion. Thus we have modified our page http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/ to include the source code.
Excellent! Honestly: I personally couldn't care less as you are a research organisation (university) so nothing could be worse than throwing "GPL stones" into you direction... (I'm working in research myself and have enough of that in daily business). Anyways: Thank you *very* much for this step, I am honestly impressed. I really hope all people would take such care... Thomas: You know our special friend I am talking about... ;-)
« Last Edit: February 05, 2008, 09:46:35 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ