views:

218

answers:

1

Our code includes vector, which includes memory, which includes Microsoft's intrin.h, but we have an intrin.h of our own on our include path. Hence memory picks up our intrin.h instead of the system one, and fails to compile.

Both our intrin.h and Microsoft's have been around for years, but we've never had a conflict before - VS 2010 introduces a new dependency. Moving or renaming our intrin.h would be a pain, and I'd rather avoid it.

Is there some way I can persuade MSVC to look in the system include directory before our own? Editing memory to say:

#include "intrin.h"

rather than

#include <intrin.h>

works, but I don't want the whole team to have to modify their Visual Studio environments (and keep them modified in the face of service packs, etc.)

Any other way of working around this?

+1  A: 

How about simply adding the system include directory to the include path before your directory?

anon
Seems like that would break his code that needs his copy of intrin.h.
sean e
@Neil: Good idea, but VS won't let me do it! If I add "$(VCInstallDir)include" to the include path then VS changes it to ".\$(VCInstallDir)include" and it fails. Even if I put in the full path (which is a bit nasty) it changes it to a relative path, which will then fail when someone checks out the project to a different directory depth. Grr! VS is being too clever for its own good!
RichieHindle
@sean: No, it would work, because some code needs one intrin.h and some needs the other, but no code needs both. If I have a way to control which one gets picked up, I can selectively apply it to the code that needs it.
RichieHindle
Might want to hit http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/threads and see if you are seeing expected behavior - for both the original problem and the relative include path problem.
sean e
Aha! By prepending "$(VCInstallDir)include;" to the text of the include path in the project properties, rather than using the "<edit>" command to edit it, this works. Thanks, Neil!
RichieHindle