Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: a71128 on July 31, 2017, 05:41:00 pm

Title: Environment variable doesn't work with Scons
Post by: a71128 on July 31, 2017, 05:41:00 pm
Hey guys,
I am trying to import my scons project into CB. However, I can't seem to set environment variables correctly because my scons script always shows variables missing.
Does anyone have experience with this? I would appreciate any input.
Thanks!

Best,
a71128
Title: Re: Environment variable doesn't work with Scons
Post by: BlueHazzard on July 31, 2017, 06:24:42 pm
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Title: Re: Environment variable doesn't work with Scons
Post by: a71128 on July 31, 2017, 07:12:53 pm
I am running Code::Blocks version 16.01 on Ubuntu 14.04.
The compiler I use is GNU GCC version 4.8.4.

When I try to build my code with custom scons setup.
It shows
Code
Error : environment variable DIR/CONFIG_DIR is not defined
        Please thoroughly read the file: README
        found at the root level of the Ottomatika directory and follow
        all of the instructions listed there.
        The short fix is to add to your .bashrc file the line:
          export DIR=YOURPATH/ottomatika/codebase
          export CONFIG_DIR=$OTTO_DIR/config
       
from the SConscript.

I have already tried exporting the variable in the pre-build steps, defining custom variables, and setting global variable but none of them work.

Thanks!
Title: Re: Environment variable doesn't work with Scons
Post by: oBFusCATed on July 31, 2017, 08:23:48 pm
What are you really trying to do?
Create a custom makefile project that executes scons for building?
Have you tried the env var plugin (http://wiki.codeblocks.org/index.php/Environment_Variables_plugin)?
Title: Re: Environment variable doesn't work with Scons
Post by: a71128 on July 31, 2017, 08:48:05 pm
What are you really trying to do?
Create a custom makefile project that executes scons for building?
Have you tried the env var plugin (http://wiki.codeblocks.org/index.php/Environment_Variables_plugin)?
Yes, that is exactly what I would like to achieve.
I wanted to try the env var plugin. However, I  couldn't find the link to the install file.
Title: Re: Environment variable doesn't work with Scons
Post by: stahta01 on July 31, 2017, 09:22:50 pm
What are you really trying to do?
Create a custom makefile project that executes scons for building?
Have you tried the env var plugin (http://wiki.codeblocks.org/index.php/Environment_Variables_plugin)?
Yes, that is exactly what I would like to achieve.
I wanted to try the env var plugin. However, I  couldn't find the link to the install file.

Make sure you have the codeblocks contrib package installed via the normal Linux package installer method.

Then, in Code::Blocks look under "Plugins" -> "Manage Plugins..." to verify the Env Vars plugin is listed and enabled.

Tim S.
Title: Re: Environment variable doesn't work with Scons
Post by: BlueHazzard on July 31, 2017, 09:59:25 pm
And then you can enable the environment variables via
Project->Properties->EnVars option

and set the environment variables via:
Settings->Environment->Environment variables

You can use variable expansion to define environment variables: http://wiki.codeblocks.org/index.php/Variable_expansion
Title: Re: Environment variable doesn't work with Scons
Post by: a71128 on August 01, 2017, 10:57:40 pm
Thanks, guys. I got it to work!