Search code examples
c++sdl

Why does MSVC /I option not find the directory?


I have a very basic project structure:

project
├───lib
│    └───SDL
│         └───SDL.h
├───src
│    └───Main.cpp
// Main.cpp
#include <SDL\SDL.h>
int main() {}

From the project directory I run the command CL /I\lib src\Main.cpp, which says src\Main.cpp(1): fatal error C1083: Cannot open include file: 'SDL\SDL.h': No such file or directory. I expected the compiler to find SDL.h since I have added /I\lib, but it does not. What am I doing wrong?


Solution

  • Use:

    /I.\lib
    

    or:

    /Ilib
    

    To refer to a relative path.