fix bugs in C++ target compilation and command line argument parser