Reputation: 6747
I am working on a Visual Studio 2013 C++ project with another programmer, using subversion to control the source. What we need is some way for each programmer to be able to write experimental code that will compile just for them, but not the other. So for me it might be:
#ifdef MATTHEW
CallMyTestFunction();
#endif
and the MATTHEW definition would be only there on my computer, and not theirs, even when we have both checked in and updated the source at any time.
I see there is a vcxproj.user file, but this appears to be unrelated to this task. Given this must be a common requirement, and I'm a newbie too VS2013, I hope that this is an easy one to solve. Thanks.
Upvotes: 0
Views: 183
Reputation: 6024
You are right - it's easy:
Open project properties
Go to: C/C++
--> Preprocessor
At the end of Preprocessor Definitions
field add: ;USER_$(USERNAME)
or ;USER_$(COMPUTERNAME)
- depends on how you want to distinguish users: by username or computer name.
Then in the code:
#ifdef USER_matthew
CallMyTestFunction();
#endif
Upvotes: 1