简体   繁体   中英

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

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM