Salve, volevo sapere come dichiarare un attributo comune a tutti gli oggetti che instanziano una certa classe.
Ho usato
static int counter=0;

ma dice:

error: ISO C++ forbids in-class initialization of non-const static member ‘counter’

ho provato allora:

const static int counter;

compila ma quando lo vado ad incrementare nel sorgente dice:

error: increment of read-only variable ‘UDPClusterApp::counter’

consigli?