J'e
J'e

Reputation: 3726

defining preprocessor definitions on a single file

I'm in the process of migrating a project to C++17. There are a couple instances of old code with deprecation warning not within my control. An example of one of these warning is, _SILENCE_CXX17_SHARED_PTR_UNIQUE_DEPRECATION_WARNING. In visual studio, I've been adding these to properties->Preprocessor Def. So far this is working fine.

To prevent the possibilities of me or someone else creating new deprecated code in the future somewhere else in the project, is there a way to minimize the scope of the preprocess definition down to a single file instead of an entire project?

Upvotes: 1

Views: 291

Answers (1)

R Sahu
R Sahu

Reputation: 206717

is there a way to minimize the scope of the preprocess definition down to a single file?

Yes, it is possible to have different preprocessor macros for a single file in Visual Studio.

In the Solution Explorer, RMB -> Properties on a specific file to change its properties.

Upvotes: 2

Related Questions