Home > Net >  Makefile Compile Error and Visual Studio Code did not recognize include files
Makefile Compile Error and Visual Studio Code did not recognize include files

Time:08-27

I use visual Studio Code and gcc-12.1.0, x86_64-w64-mingw32 and SDL2.

I have folowing Makefile:

all:
    g   -I scr/include -L scr/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2

If I only have one main.cpp comiling and everything works. But now I added Header files and other C files. But I see already in Visual Studio Code that the Include .cpp and .h are getting an error that the file is not found. But the Files in die Directory and same project as main.cpp

Error

What do I have to change or what I´m doing wrong?

BR druckgott

CodePudding user response:

It was my makefile, now it works:

all:
g   -I scr/include -L scr/lib -o main main.cpp MSController.cpp MSGameWindow.cpp MSEventHandler.cpp -lmingw32 -lSDL2main -lSDL2

CodePudding user response:

g should be able to handle it, but for local includes you would usually use #include "" not #include <>. Otherwise, try to compile manually from the command line and see if the issue is related to your makefile / vs-code or if the include really can't be found.

  • Related