C++ code builds correctly