We cannot tell what the problem may be because your test.cpp program does not compile at all. So we cannot run it here and produce the respective LP file.
Please attach a code that is self-contained, can be compiled and run, and illustrates the problem. At least attach the LP file that is produced from the C++ code. Moreover, to allow comparison of the two models, you should name your variables in the C++ code in the same way they are named by OPL.
#CPLEXOptimizers#DecisionOptimization