I am working on a project that uses "make and gcc" to compile all of its modules. These modules are in their own folders and have their own Makefiles. The global makefile calls them to compile the binary.
So now I am trying to use Visual Studio Code as my IDE. I created a compilation environment and it works well.
The only problem is, whenever there is a warning or compilation, clicking on them does not open the correct file. My working directory will look like the simplified code below.
D:\SO |-- common | |-- main.c | `-- Makefile `-- Makefile
From the tasks, I will call an external Makefile, which will call the Makefile inside the general. And in main.c, I intentionally deleted the inclusion of the stdio.h header file, in which the implicit declaration should be displayed. But when I click the warnings in the problems window, the VS code throws an error until the file is found. VS Code is trying to open "D: \ SO \ main.c", but the file is inside "D: \ SO \ common \ main.c"

External Makefile
all: (cd common && make )
Internal Makefile (inside a shared directory)
all: gcc main.c
main.c
int main(int argc, char *argv[]) { printf("Hello World"); return 0; }
tasks.json
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "taskName": "make", "command": "make", "type": "shell", "problemMatcher": [ "$gcc" ] } ] }
I tried to configure problemMatcher by suggesting different combinations for the fileLocation parameter. But they do not give the correct result. Therefore, I did not include it here.
I am using Visual Studio Code 1.14.2 for Windows 10 1607 x64 with mingw-gcc.