Author Topic: Single file compilation + target  (Read 5767 times)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Single file compilation + target
« on: January 31, 2006, 06:36:18 pm »
Once in the forums I made a commet about having an extra compiler section for single file compilation, so you could have "global compiler options", "compiler options per project", "compiler options per target" and "compiler options for single file compilation".

Well, I decided to extend the idea so you could use the target combobox in the toolbar.

That way you could define different compilation flags and libraries, even compiler, to use when compiling a single file.

Examples of it could be a "target" for wxWidgets, a "target" for pthreads, a "target" for sockets, a "target" for allegro, ...

That way you'd just need to create a file, select the "target" in the combobox, compile and run. It'd be really handy to make little test programs for everything, not just console programs.

Creating a whole project for a single file with a few lines of code which will be just a program to test something is really too much, and modifying the global compiler options to get libraries and flags sent to the linker/compiler isn't the best approach, but unfortunately it's the one I'm using.

The idea could be extended even more so even projects could specify a different target' (it'd need another name of course). For example the Code::Blocks project could have the following target' options: Debug, Release, Unicode Debug, Unicode Release. The idea is to have everything in a single project file instead of four project files.

I just wanted to comment this idea here instead of adding a Feature Request.

Don Corleone's opinion is really important here :)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Single file compilation + target
« Reply #1 on: January 31, 2006, 07:05:16 pm »
The idea is good, but I think targets are not the correct place to put that information.

Even if it is implemented with a target internally, it should not "pollute" the target combobox, I think.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Single file compilation + target
« Reply #2 on: January 31, 2006, 07:42:10 pm »
Single file compilation has been added and supported solely for simple few-lines console programs. If you want to test a "quick" wxWidgets app, create a project ;)

With that said, maybe this area could use some scripting? :lol:
Be patient!
This bug will be fixed soon...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Single file compilation + target
« Reply #3 on: January 31, 2006, 09:54:02 pm »
In fact, a solution I'm using is to create a copy from the current compiler (GCC here) and add in this copy the libraries and flags I need. The problem now is that I have to set it as default whenever I want to compile with a specific set of flags and libraries.

The idea is a way to avoid such kind of evil things so... what about a tab (or anything else) to specify flags and libraries for single file compilation or any other way to switch from one set of flags to another?

Really, I want (I wonder if I'mn't the only one) to avoid creating projects for so small and "useless" programs, but that won't be simply console programs.

Don Corleone: will those scripts work for single file compilation, only, and won't get mixed when I open a project? (I don't have a copy of Code::Blocks handy in college to try that and a nightly wouldn't do 'cause it's a Linux box).

More evil tricks are welcomed too :twisted: