News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Add file to project that are located in path in global variable [?]

Started by Totoxa, January 05, 2014, 11:15:59 PM

Previous topic - Next topic

Totoxa

Could I add files to a project (to compile and link) that are located in path in global variable?

MortenMacFly

Quote from: Totoxa on January 05, 2014, 11:15:59 PM
Could I add files to a project (to compile and link) that are located in path in global variable?
The PATH envvar is used by command line processors to find executable and libraries, not general (text) files. It woudn't make sense, really.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Totoxa

Quote from: MortenMacFly on January 06, 2014, 09:02:33 AM
Quote from: Totoxa on January 05, 2014, 11:15:59 PM
Could I add files to a project (to compile and link) that are located in path in global variable?
The PATH envvar is used by command line processors to find executable and libraries, not general (text) files. It woudn't make sense, really.

I don't didn't mean the PATH env variable, I mean a path in a global variable, ex: I unzip some source(.c) files in /home/some/random/path, in Linux I create a global variable 'GLOB_VAR' and set it to /home/some/random/path but in Windows I set 'GLOB_VAR=X:/some/random/path/', then, in some project I add a .c file that is located on '/home/some/random/path' or in 'X:...', I know I could use relative paths but...

PD: Sorry if I did not express myself (In english).

MortenMacFly

Mmmh... You know that this is really error prone? So it is not supported directly. However, there is a hidden "glob" feature for Code::Blocks that can do such. Search the forums accordingly.

But I can really only recommend to use the add files recursively" option and do it properly otherwise you'll end up with well hidden errors sooner or later...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

killerbot

the glob feature can do this for you, there is no gui interface for it yet, so you need to adjust your cbp file in an editor.

Remember to reload the project the moment you added/removed files in that directory

Example :

<UnitsGlob directory="../export/" recursive="1" wildcard="" />
<UnitsGlob directory="../local/" recursive="1" wildcard="" />


You put this at the spot where normally the <Units> would exist. wildcard empty means the rules that cb use (just like when you add files via the gui interface), but you can specify your own wildcard pattern.