# Environment setting



## hazz (Aug 20, 2015)

Hi to everyone. How can I set my environment so I can use cc Clang instead of GCC when I'm compiling software? Thanks for helping.


----------



## talsamon (Aug 20, 2015)

Which FreeBSD version? Since 9.3 clang is default. `CC=clang(XY) CXX=clang++(XY) CPP=clang-cpp(XY)` - you can set with XY the clang version, but it is optional.


----------



## protocelt (Aug 20, 2015)

talsamon said:


> Which FreeBSD version? Since 9.3 clang is default. `CC=clang(XY) CXX=clang++(XY) CPP=clang-cpp(XY)` - you can set with XY the clang version, but it is optional.


Keep in mind that by setting your choice of default compiler in /etc/make.conf like that, your system will use it for everything including all ports. This may not be a good idea. There are a few ports that still require GCC to build and/or function correctly.


----------



## hazz (Aug 20, 2015)

Why do I always got this error?
FreeBSD GCC cannot create executables.
I'm with FreeBSD 11
Thank you


----------



## protocelt (Aug 20, 2015)

FreeBSD 11-CURRENT is a development version and not a supported version of FreeBSD: Topics about unsupported FreeBSD versions

That said, you could ask this question on the CURRENT mailing list where these things are discussed: https://lists.freebsd.org/mailman/listinfo/freebsd-current


----------

