I’ve got a program (LAMMPS, as it happens) spanning many .cpp/.h files, all of which share a namespace. There are many variables referenced in source files, but which are initialised in some other file.
Is there a way to find which file the variable is initialised in?
Perhaps this is better placed in superuser, as I reckon some clever find/grep work could do this, but I’m not even sure what I’d be looking for (I don’t know what type the variables are, for example).
Go with ‘ctags’. It will create a cross reference listing of all the symbols in your code. Of course find & grep will work too 🙂