Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Anonymous on June 09, 2005, 10:10:40 pm

Title: Environment Variables
Post by: Anonymous on June 09, 2005, 10:10:40 pm
Hello, I have a few closely related questions:

1. Does CB currently support using environment variables as part of the include/link paths (in terms of using such a path, not in terms of specifying it - I know the latter is not suported through the IDE (right?)).

2. If the answer to 1 is positive, is there a cross-platform syntax to specify the environment variables?

3. What is the syntax to specify the environment variables (if there is one)?
Title: Environment Variables
Post by: mandrav on June 09, 2005, 10:48:16 pm
$(SOME_ENV_VAR)

Yiannis.
Title: Environment Variables
Post by: rickg22 on July 13, 2005, 05:27:36 am
IMPORTANT NOTE:

With "environment variables" I think Yiannis referred to "Custom variables" specified elsewhere. And (someone correct me if i'm wrong) IIRC, using "real environment variables" wasn't supported in 1.0-finalbeta. It was added later in CVS.
Title: Environment Variables
Post by: darklordsatan on July 13, 2005, 06:32:38 am
I might be blind but I dont see any option to specify "real environment variables", and I just compiled the CVS version...
In case Im wrong, were can I specify such option?
And last, is this related to the request of someone (who also pointed in the request to a thread where you were in, rickg22) in sf, relating "pre-command line" or something like this?
Title: Environment Variables
Post by: rickg22 on July 13, 2005, 07:32:00 am
hmm maybe i was wrong then. Sorry :oops:
Title: Environment Variables
Post by: mandrav on July 13, 2005, 08:51:36 am
Quote
1. Does CB currently support using environment variables as part of the include/link paths (in terms of using such a path, not in terms of specifying it - I know the latter is not suported through the IDE (right?)).

This feature was added last week. You can use environment variables anywhere in compiler settings.

Quote
2. If the answer to 1 is positive, is there a cross-platform syntax to specify the environment variables?

3. What is the syntax to specify the environment variables (if there is one)?

You can use any of these forms, no matter what platform you work on:
Code
$SOMEVAR
$(SOMEVAR)
${SOMEVAR}
%SOMEVAR%


Yiannis.
Title: Environment Variables
Post by: darklordsatan on July 13, 2005, 09:39:58 am
Yiannis, where exactly, I cant seem to make the PATH env variable to work (I use it inside my app, but I specify some values for it in custom variables and more options in compiler settings but nothing happens)
Title: Environment Variables
Post by: mandrav on July 13, 2005, 09:46:35 am
Maybe I wasn't clear enough:
You cannot set environment variables, only use (aka read) them...
It's not difficult to set env vars too, but what's the point? They 'll only be valid while C::B is running...

[EDIT]: we are talking about the CVS version, right?

Yiannis.
Title: Environment Variables
Post by: darklordsatan on July 13, 2005, 09:58:27 am
Oh! I get what you mean... and yes, its cvs were talking about
Title: Environment Variables
Post by: mandrav on July 13, 2005, 12:06:05 pm
Well, now that we were talking about it, I 've found a bug in the implementation that would allow env vars only in global compiler options.
I 'm fixing it now and I 'm also adding the ability to set env vars :)

Yiannis.
Title: Environment Variables
Post by: darklordsatan on July 13, 2005, 12:25:09 pm
Oh cool, I was actually starting to make a plugin to set environment vars (already have a somewhat implementation in project->set execution parameters), but you're the man.
Please tell me when you're done as Id like to test it!
Cheers
Title: Environment Variables
Post by: mandrav on July 13, 2005, 12:45:59 pm
Follow up here (http://www.codeblocks.org/index.php?name=PNphpBB2&file=viewtopic&t=542&start=0&postdays=0&postorder=asc&highlight=).

Yiannis.