If both wx-config outputs are from the same machine and the same user, C::B and the console must run with different environments.
If your wx-config for wx2.9 is not in /usr/bin, but e.g. in /usr/local/bin, you might need to use the absolute path for it in the compiler and linker options.
C::B puts the compilers search path (usually /usr/bin) in the front of the path it uses for building to ensure the correct compiler is used.