Changed entity build to use global env.
Compile for C++11