Search code examples
c++visual-studiounixdirectory-structurewindows

Mac and Windows difference header path (/ vs \)


I have a Windows project that also works on XCode. But I had to changed all the source header paths like

#include "Adapter\EngineAdapterFactory.hpp"

to

#include "Adapter/EngineAdapterFactory.hpp"

This is quite annoying and I might have to reverse the process for Visual Studio later. How can others solve this problem?


Solution

  • You should be able to use Adapter/EngineAdapterFactory.hpp on both platforms.

    (At least that's the case with GCC on Windows.)

    Actually, that's not just the trait of compilers - even with Windows Explorer you should be able to navigate with / as directory separator. Open up Explorer and insert in your address bar something like: c:/Some/Folder/Structure. Should work flawlessly unless you're on a really old Windows version (I can confirm it working on XP and up, but probably it's there even longer). Thanks, Microsoft, for being compatible! :)