I am trying to print out to console using a macro the variable name for display members value while debugging ( logging ).
How to do that? I tried the following but it doesnt’ work.
#define MY_PRINT(x) std::cout << "'x'=" << x << std::endl;
int main(){
int my_variable=3;
MY_PRINT( my_variable );
// I would like to print to console
// 'my_variable'=3
}
Auch… I found the solution.
I should write the macro like this