The correct usage of cling::Interpreter
zhengxuwen-nc opened this issue · comments
My work consists of four CPP files, with two of them involving mutual function calls. In dep.cpp, the onStart function calls the show function in the dog.cpp file. When using cling::Interpreter to declare these CPP files successively (declare dep.cpp first and then declare dog.cpp), how can the issue of the show() function’s logic not being executed when the onStart function is executed be resolved?
For example:
dep.cpp content:
#include "dog.h"
void Dep::onStart(){
Dog dog;
std::cout << "1b\n";
dog.show();
std::cout << "2c\n";
}
dog.cpp content:
void Dog::show(){
std::cout << "dog show\n";
}
The result of executing this code is:
1b
2c
PS: I am unable to completely decouple the mutual calling relationship between the two CPP files.