Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: rickg22 on June 08, 2005, 12:37:32 am

Title: Compile single file. Approve / disapprove?
Post by: rickg22 on June 08, 2005, 12:37:32 am
Do you think codeblocks should allow to compile a single file (without a project)?

Yes / No / Why? Remember, it's you users who decide! :)
Title: Compile single file. Approve / disapprove?
Post by: Profic on June 08, 2005, 09:11:32 am
Well, this stuff may be usefull for quick'n'dirty written programs to solve small problems
However it's not necessary as c::b allow project with one file in it :)
Moreover rare program has only one source file
Title: Compile single file. Approve / disapprove?
Post by: Urxae on June 08, 2005, 02:14:58 pm
I don't really need it, as I rarely need to compile a single file, and if I ever do I can always use my always-open command prompt.

So I wouldn't mind if you add it, but no rush ;).
Title: Compile single file. Approve / disapprove?
Post by: David Perfors on June 08, 2005, 04:50:28 pm
It is not needed for me, mingw only compiles modified c/cpp files. It is nice to have it when you only change 1 .h file :)

Quote from: fvbommel
but no rush ;).
:lol:
Title: Compile single file. Approve / disapprove?
Post by: upCASE on June 08, 2005, 05:14:30 pm
Hi!
Although this is covered by editors like SCiTE, I guess it's a nice feature, especially for newbies in programming who mostly deal with single files when they start programming in C.
Title: Compile single file. Approve / disapprove?
Post by: rickg22 on June 08, 2005, 06:29:56 pm
I think that it would be nice to compile single files. However, i'd like to choose a project (or template) to compile them. If i choose a project, the file is compiled as part of the project, without altering the project per se.

I'd have to look more into this to see how it could be done. But at least the idea looks fine to me.

Example:

You're about to compile a single file. Please choose:
* Compile into console executable
* Just compile as it is
* add to project and compile.
Title: Compile single file. Approve / disapprove?
Post by: SartriX on June 09, 2005, 11:25:29 am
I would see more gain in being able to compile multiple executables in one project. For example you got a program with GUI and you want the exact same program also available as console/parameter based, but want both to be single file executables without shared libraries. Instead of having 2 'projects' in the same folder with the same files listed in each, I'ld rather be able to make a new target that links to another file in the project and a different executable name.

Ofcourse this could also be easily used then to have an educational project holding multiple single-file executables.
Title: Compile single file. Approve / disapprove?
Post by: AkiraDev on June 09, 2005, 12:48:58 pm
Quote from: SartriX
I would see more gain in being able to compile multiple executables in one project. For example you got a program with GUI and you want the exact same program also available as console/parameter based, but want both to be single file executables without shared libraries. Instead of having 2 'projects' in the same folder with the same files listed in each, I'ld rather be able to make a new target that links to another file in the project and a different executable name.

Ofcourse this could also be easily used then to have an educational project holding multiple single-file executables.


Someone correct me otherwise, but I think you can already do that by setting multiple targets.
Title: Compile single file. Approve / disapprove?
Post by: Urxae on June 09, 2005, 01:21:20 pm
SartriX: Just put the shared part in a static library and link it to both executables. That way you only have to compile that part once and it'll be included in both executables.
So indeed, use three targets:
Title: Compile single file. Approve / disapprove?
Post by: mandrav on June 09, 2005, 01:48:29 pm
Quote
Someone correct me otherwise, but I think you can already do that by setting multiple targets.

No need to correct you. You 're absolutely right :)

Yiannis.
Title: Compile single file. Approve / disapprove?
Post by: SartriX on June 10, 2005, 01:47:46 am
Quote from: mandrav
Quote
Someone correct me otherwise, but I think you can already do that by setting multiple targets.

No need to correct you. You 're absolutely right :)

Yiannis.
I hate missing buttons. Darn those graphical IDE's. *goes back to vim* :P

Anyway.. since you can even make targets for one file, one for each single file in a project even, then what's the point of the original question? Except for saving some minor clicking, I don't see it as an improvement, just another button too many.
Title: Compile single file. Approve / disapprove?
Post by: tiwag on June 10, 2005, 02:29:53 am
Maybe some of you know PellesC http://smorgasbordet.com/pellesc/index.htm
a beautiful small but powerful Win32 C-compiler with IDE & Debugger.

Pelle (author of PellesC) has solved this point elegant.

if one wants to compile a source file without prior defining a project, then the IDE prompts,
if one wants to create a default project with the actual source file.
This default settings are good for a typical Hello-world console program,
which is practically good enough for all of that first-time hobby-programmers,
which are learning how to use a compiler, linker, debugger, IDE's and so on, and
still not know the difference of the mentioned tools nor are able to resolve linker errors
nor are able to set up a meaningful project setup with different source and header files.

This keeps the Pelles-C forum  http://smorgasbordet.com/phpBB2/index.php
*nearly* free of the typical "cannot compile" spam.