Hi ! I have a problem with debug in c++. I'm using this —
void DBG() { cerr << "]" << endl; } template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
ifdef _DEBUG
define dbg(...) cerr << "LINE(" << LINE << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
else
define dbg(...) 0
endif
When i type for example — int a = 5; dbg(a);
It's not showing any output.
Add -D_DEBUG to GCC command line on your local computer. And replace the line define dbg(...) cerr << "LINE(" << LINE << ") -> [" << with define dbg(...) cerr << "LINE(" << __ LINE__ << ") -> [" <<