Code completion still confirms the macro after undef

I have a bunch of macros that are only for a small area of ​​the project. I want to define them so that they do not pollute the global namespace, but Visual Studio still confirms their presence after #undef in other files. IE:

//A.hpp

#define A_MACRO

...

//~A.hpp

#undef A_MACRO

...

//B.hpp

#include "A.hpp"

#include "~A.hpp"

...

//main.cpp

#include "B.hpp"

A_MACRO // <- code completion recognizes this despite it being undefined
        // and invalid

Do I just need to deal with this, or is there another way to accomplish what I'm trying to do?

EDIT: It seems that Code :: Blocks correctly removes it outside of #undef, so it should be something in Visual Studio settings.

+4
source share
1 answer

Its a valid tag.

Note that somewhere in your code you can add:

#ifdef A_MACRO
...
#endif

or even:

#ifndef A_MACRO
...
#endif

, Intellisense ?

​​ . .

0

All Articles