User forums > General (but related to Code::Blocks)

Compile single file. Approve / disapprove?

<< < (2/3) > >>

rickg22:
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.

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.

AkiraDev:

--- 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.
--- End quote ---


Someone correct me otherwise, but I think you can already do that by setting multiple targets.

Urxae:
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:
[*]A static library (must be first in compile order)
[*]The console executable, link static library into this.
[*]The GUI executable, link static library into this as well.
[/list:u]

mandrav:

--- Quote ---Someone correct me otherwise, but I think you can already do that by setting multiple targets.
--- End quote ---

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

Yiannis.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version