Visual C++ Developer Center >
Visual C++ Forums
>
Visual C++ Language
>
can I get the preprocessor to disallow backslashes in #include file paths?
can I get the preprocessor to disallow backslashes in #include file paths?
The C preprocessor in Visual Studio allows either forward or back slashes in the quoted string following a #include directive.
I'd like to disallow backslashes, so people working with Visual Studio wouldn't check code into the SCM repository that doesn't compile on other compilers.
#include "path\to\foo.h" // breaks the build- Edited byeric.slosser Thursday, November 05, 2009 8:10 PMclarification
Answers
- I don't think that is possible, directly.
You could, easily enough, write a Visual Studio macro which executes on the file save event that would correct those kind of mistakes.
- Marked As Answer byRong-Chun ZhangMSFT, ModeratorTuesday, November 17, 2009 11:52 AM
- Hello Eric,
I agree with Simon. You can write some Macro or add-in to check this. If you have any difficulty in writing the Macro, you can post on the VSX forum. The forum discusses Visual Studio Extensibility (VSX), including the Visual Studio SDK, add-ins, and macros.
http://social.msdn.microsoft.com/Forums/en-US/vsx
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byRong-Chun ZhangMSFT, ModeratorTuesday, November 17, 2009 11:52 AM
All Replies
- I don't think that is possible, directly.
You could, easily enough, write a Visual Studio macro which executes on the file save event that would correct those kind of mistakes.
- Marked As Answer byRong-Chun ZhangMSFT, ModeratorTuesday, November 17, 2009 11:52 AM
- Hello Eric,
I agree with Simon. You can write some Macro or add-in to check this. If you have any difficulty in writing the Macro, you can post on the VSX forum. The forum discusses Visual Studio Extensibility (VSX), including the Visual Studio SDK, add-ins, and macros.
http://social.msdn.microsoft.com/Forums/en-US/vsx
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byRong-Chun ZhangMSFT, ModeratorTuesday, November 17, 2009 11:52 AM
Hello Eirc,
Have you got any progress on this issue? Would you mind letting me know the result of the suggestions? If you have any additional question, welcome to post here.
Have a great day!
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


