fix build errors when compiler is C++