0

i'm working on a little c++ cross platform project, using glfw and glew. I wrote the original code on windows, where you include e.g. glfw like this

#include <GLFW\glfw3.h>

When i tried to ccompile on linux it went wrong because linux uses the "/" and not the "\" like windows, so i had to replace them all. Is there a simple solution to this simple problem?

Thanks in advance!

Wouter Standaert
  • 299
  • 1
  • 4
  • 13
  • 1
    Yes it is: both Windows and Unix uses /, although in Windows you can use \ as well. Always use / to be platform compatible. But I think that's the smallest problem you'll face when developing for Unix and Windows. You need to use the #ifdef WIN32 and #else compile directive in the include part of you code – ja_mesa Jun 08 '14 at 10:16

2 Answers2

1

According to the accepted answer to a similar question, just always use forward slash (/) for include paths.

This question should also help.

Community
  • 1
  • 1
djikay
  • 10,450
  • 8
  • 41
  • 52
1

Yes, use forward slashes no matter what OS you are developing on.

Backslashes are IMHO an abomination.

Also you might consider using something like CMake to build your code on both platforms.

wojciii
  • 4,253
  • 1
  • 30
  • 39