I think that you might be confusing two separate things with each
other. %BuildCube does not compile the cube class. There are two steps
here:
1) Compile the class - in the Architect, in Studio, or in the Terminal
via d ##class(%System.OBJ).Compile(classname)
If the class won't compile, look at the compilation errors and then
correct the problem they indicate.
2) When the class is compiled, then build the cube, in the Architect
or via %BuildCube.