Go to Definition (F12) not taking you to the correct line in Visual Studio for C/C++ code

71 Views Asked by At

I work in the Visual Studio IDE. I inhered some C code where a lot of macros are defined: it's like a cascade of macros are referring to some other replacement, again referring to some other replacement.

However when I press F12 (See/Go to Definition) on one of these "variables" (I don't know how to call them), I end up in the right file, but on the wrong line. Any idea how to fix this?

Below some example:

So f is a pointer of type Fichiers that stores the memory address of an instance of class Fichiers, namely Fichiers (which is an object).

Name    Value   Type
_f_->input.produit_1[0].actu.desc_prod.c_tarif  70  int
        

Some relevant pieces of code

#define _f_NUMERO_TT            (_f_PARM_PROD.actu.desc_prod.num_TT) // _f_->input.produit_1[0].actu.desc_prod.num_TT

#define _f_PARM_PROD    (_f_INPUTS.produit_1[PACKAGE_PRODUIT_BASE]) 

    struct Inputs
    {
#define _f_INPUTS  (_f_->input)

        struct ParametersInputs
        {
#define _f_PARAMETERS   (_f_INPUTS.parameter) //_f_->input.parameter

            DATE date_fichiers;
            DATE date_fichiers_pp;
...
So instead of pasting "_f_NUMERO_TT" I need to replace it everywhere with
_f_->input.produit_1[0].actu.desc_prod.num_TT   
0

There are 0 best solutions below