File not found error on Visual Studio Code when clicking on problems window (using make, gcc and gcc...












6















I work on a project which uses "make and gcc" to compile all its modules. These modules are on their own folders and have their own Makefiles. A global Makefile calls them in order to compile the binary.



So now I am trying to use Visual Studio Code as my IDE. I have set up the compilation environment and it works well.



The only problem is whenever there is some warning/compilation, clicking on them doesn’t open the proper file. My working directory will be similar to the below shown simplified code.



D:SO
|-- common
| |-- main.c
| `-- Makefile
`-- Makefile


From the tasks I will be calling the outside Makefile, which will call the Makefile inside common. And in the main.c, I have deliberately deleted stdio.h header file inclusion, which should show an implicit declaration error.
But when I click warnings on problem window, VS code throws an error showing the file is not found. VS Code tries to open "D:SOmain.c", but the file is actually inside "D:SOcommonmain.c"



enter image description here



Outer Makefile



all:
(cd common && make )


Inner Makefile (inside common 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 have tried to tweak the problemMatcher by giving different combinations for fileLocation parameter. But they don’t yield a proper result. So I haven't included it here.



I am using Visual Studio Code 1.14.2 on Windows 10 1607 x64 with a mingw-gcc.










share|improve this question

























  • this problem just started for me after the last vscode update. Sucks because i was just starting to like it after using it for about 3 weeks. We should be coding....not troubleshooting our IDE.

    – jtlindsey
    Mar 13 '18 at 0:31













  • FWIW, I'm also running into this problem. More than a year later. What we want is for fileLocation to be automatically computed on a per-Makefile basis.

    – seanahern
    Nov 21 '18 at 20:48
















6















I work on a project which uses "make and gcc" to compile all its modules. These modules are on their own folders and have their own Makefiles. A global Makefile calls them in order to compile the binary.



So now I am trying to use Visual Studio Code as my IDE. I have set up the compilation environment and it works well.



The only problem is whenever there is some warning/compilation, clicking on them doesn’t open the proper file. My working directory will be similar to the below shown simplified code.



D:SO
|-- common
| |-- main.c
| `-- Makefile
`-- Makefile


From the tasks I will be calling the outside Makefile, which will call the Makefile inside common. And in the main.c, I have deliberately deleted stdio.h header file inclusion, which should show an implicit declaration error.
But when I click warnings on problem window, VS code throws an error showing the file is not found. VS Code tries to open "D:SOmain.c", but the file is actually inside "D:SOcommonmain.c"



enter image description here



Outer Makefile



all:
(cd common && make )


Inner Makefile (inside common 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 have tried to tweak the problemMatcher by giving different combinations for fileLocation parameter. But they don’t yield a proper result. So I haven't included it here.



I am using Visual Studio Code 1.14.2 on Windows 10 1607 x64 with a mingw-gcc.










share|improve this question

























  • this problem just started for me after the last vscode update. Sucks because i was just starting to like it after using it for about 3 weeks. We should be coding....not troubleshooting our IDE.

    – jtlindsey
    Mar 13 '18 at 0:31













  • FWIW, I'm also running into this problem. More than a year later. What we want is for fileLocation to be automatically computed on a per-Makefile basis.

    – seanahern
    Nov 21 '18 at 20:48














6












6








6


2






I work on a project which uses "make and gcc" to compile all its modules. These modules are on their own folders and have their own Makefiles. A global Makefile calls them in order to compile the binary.



So now I am trying to use Visual Studio Code as my IDE. I have set up the compilation environment and it works well.



The only problem is whenever there is some warning/compilation, clicking on them doesn’t open the proper file. My working directory will be similar to the below shown simplified code.



D:SO
|-- common
| |-- main.c
| `-- Makefile
`-- Makefile


From the tasks I will be calling the outside Makefile, which will call the Makefile inside common. And in the main.c, I have deliberately deleted stdio.h header file inclusion, which should show an implicit declaration error.
But when I click warnings on problem window, VS code throws an error showing the file is not found. VS Code tries to open "D:SOmain.c", but the file is actually inside "D:SOcommonmain.c"



enter image description here



Outer Makefile



all:
(cd common && make )


Inner Makefile (inside common 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 have tried to tweak the problemMatcher by giving different combinations for fileLocation parameter. But they don’t yield a proper result. So I haven't included it here.



I am using Visual Studio Code 1.14.2 on Windows 10 1607 x64 with a mingw-gcc.










share|improve this question
















I work on a project which uses "make and gcc" to compile all its modules. These modules are on their own folders and have their own Makefiles. A global Makefile calls them in order to compile the binary.



So now I am trying to use Visual Studio Code as my IDE. I have set up the compilation environment and it works well.



The only problem is whenever there is some warning/compilation, clicking on them doesn’t open the proper file. My working directory will be similar to the below shown simplified code.



D:SO
|-- common
| |-- main.c
| `-- Makefile
`-- Makefile


From the tasks I will be calling the outside Makefile, which will call the Makefile inside common. And in the main.c, I have deliberately deleted stdio.h header file inclusion, which should show an implicit declaration error.
But when I click warnings on problem window, VS code throws an error showing the file is not found. VS Code tries to open "D:SOmain.c", but the file is actually inside "D:SOcommonmain.c"



enter image description here



Outer Makefile



all:
(cd common && make )


Inner Makefile (inside common 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 have tried to tweak the problemMatcher by giving different combinations for fileLocation parameter. But they don’t yield a proper result. So I haven't included it here.



I am using Visual Studio Code 1.14.2 on Windows 10 1607 x64 with a mingw-gcc.







visual-studio-code vscode-settings vscode-tasks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 9 '17 at 16:05









halfer

14.7k759116




14.7k759116










asked Aug 9 '17 at 14:54









MrPavanayiMrPavanayi

512412




512412













  • this problem just started for me after the last vscode update. Sucks because i was just starting to like it after using it for about 3 weeks. We should be coding....not troubleshooting our IDE.

    – jtlindsey
    Mar 13 '18 at 0:31













  • FWIW, I'm also running into this problem. More than a year later. What we want is for fileLocation to be automatically computed on a per-Makefile basis.

    – seanahern
    Nov 21 '18 at 20:48



















  • this problem just started for me after the last vscode update. Sucks because i was just starting to like it after using it for about 3 weeks. We should be coding....not troubleshooting our IDE.

    – jtlindsey
    Mar 13 '18 at 0:31













  • FWIW, I'm also running into this problem. More than a year later. What we want is for fileLocation to be automatically computed on a per-Makefile basis.

    – seanahern
    Nov 21 '18 at 20:48

















this problem just started for me after the last vscode update. Sucks because i was just starting to like it after using it for about 3 weeks. We should be coding....not troubleshooting our IDE.

– jtlindsey
Mar 13 '18 at 0:31







this problem just started for me after the last vscode update. Sucks because i was just starting to like it after using it for about 3 weeks. We should be coding....not troubleshooting our IDE.

– jtlindsey
Mar 13 '18 at 0:31















FWIW, I'm also running into this problem. More than a year later. What we want is for fileLocation to be automatically computed on a per-Makefile basis.

– seanahern
Nov 21 '18 at 20:48





FWIW, I'm also running into this problem. More than a year later. What we want is for fileLocation to be automatically computed on a per-Makefile basis.

– seanahern
Nov 21 '18 at 20:48












1 Answer
1






active

oldest

votes


















1














This isn't an answer to your question, but I expect it would be a prerequisite to any solution that Microsoft or others could provide.



You have a bug in your nested Makefiles. You should never do this pattern in a Makefile:



cd somewhere; make target


The cd is unnecessary (see below), but the use of make directly is a problem. Such a pattern messes up the ability for one invocation of make to pass information to sub-makes. In particular, it messes up parallel make. It also invokes make with the current shell path, which might not be the make that was originally used. You should always use this pattern instead:



$(MAKE) -C somewhere target


The -C dir parameter tells make where to set its current working directory. And using $(MAKE) allows flags and parameters to be passed down.



Since this is the recommended nested-Makefile pattern, I would think that any parsing that vscode would do to determine the appropriate fileLocation would likely require it.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45594118%2ffile-not-found-error-on-visual-studio-code-when-clicking-on-problems-window-usi%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    This isn't an answer to your question, but I expect it would be a prerequisite to any solution that Microsoft or others could provide.



    You have a bug in your nested Makefiles. You should never do this pattern in a Makefile:



    cd somewhere; make target


    The cd is unnecessary (see below), but the use of make directly is a problem. Such a pattern messes up the ability for one invocation of make to pass information to sub-makes. In particular, it messes up parallel make. It also invokes make with the current shell path, which might not be the make that was originally used. You should always use this pattern instead:



    $(MAKE) -C somewhere target


    The -C dir parameter tells make where to set its current working directory. And using $(MAKE) allows flags and parameters to be passed down.



    Since this is the recommended nested-Makefile pattern, I would think that any parsing that vscode would do to determine the appropriate fileLocation would likely require it.






    share|improve this answer




























      1














      This isn't an answer to your question, but I expect it would be a prerequisite to any solution that Microsoft or others could provide.



      You have a bug in your nested Makefiles. You should never do this pattern in a Makefile:



      cd somewhere; make target


      The cd is unnecessary (see below), but the use of make directly is a problem. Such a pattern messes up the ability for one invocation of make to pass information to sub-makes. In particular, it messes up parallel make. It also invokes make with the current shell path, which might not be the make that was originally used. You should always use this pattern instead:



      $(MAKE) -C somewhere target


      The -C dir parameter tells make where to set its current working directory. And using $(MAKE) allows flags and parameters to be passed down.



      Since this is the recommended nested-Makefile pattern, I would think that any parsing that vscode would do to determine the appropriate fileLocation would likely require it.






      share|improve this answer


























        1












        1








        1







        This isn't an answer to your question, but I expect it would be a prerequisite to any solution that Microsoft or others could provide.



        You have a bug in your nested Makefiles. You should never do this pattern in a Makefile:



        cd somewhere; make target


        The cd is unnecessary (see below), but the use of make directly is a problem. Such a pattern messes up the ability for one invocation of make to pass information to sub-makes. In particular, it messes up parallel make. It also invokes make with the current shell path, which might not be the make that was originally used. You should always use this pattern instead:



        $(MAKE) -C somewhere target


        The -C dir parameter tells make where to set its current working directory. And using $(MAKE) allows flags and parameters to be passed down.



        Since this is the recommended nested-Makefile pattern, I would think that any parsing that vscode would do to determine the appropriate fileLocation would likely require it.






        share|improve this answer













        This isn't an answer to your question, but I expect it would be a prerequisite to any solution that Microsoft or others could provide.



        You have a bug in your nested Makefiles. You should never do this pattern in a Makefile:



        cd somewhere; make target


        The cd is unnecessary (see below), but the use of make directly is a problem. Such a pattern messes up the ability for one invocation of make to pass information to sub-makes. In particular, it messes up parallel make. It also invokes make with the current shell path, which might not be the make that was originally used. You should always use this pattern instead:



        $(MAKE) -C somewhere target


        The -C dir parameter tells make where to set its current working directory. And using $(MAKE) allows flags and parameters to be passed down.



        Since this is the recommended nested-Makefile pattern, I would think that any parsing that vscode would do to determine the appropriate fileLocation would likely require it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 20:54









        seanahernseanahern

        10510




        10510
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45594118%2ffile-not-found-error-on-visual-studio-code-when-clicking-on-problems-window-usi%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents