Building code that compiles in both IDE and CLI

@bko Thanks!