microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.4k stars 1.51k forks source link

Add system include path support for pre-VS2015 compilers #3687

Open Gruntfuggly opened 5 years ago

Gruntfuggly commented 5 years ago

I'm trying to get my Windows set up to work properly, but at the moment I get errors saying it can't find source files even though I can control+click on the files and open them.

Config:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include",
                "C:/Users/nscott/workspace/asldev/aslcore/",
                "C:/Users/nscott/workspace/qt4/qt4/include"
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "path": [
                    "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include/",
                    "C:/Users/nscott/workspace/asldev/aslcore/",
                    "C:/Users/nscott/workspace/qt4/qt4/include",
                    "${workspaceRoot}"
                ]
            },
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "compileCommands": "C:\\w\\build_x86_debug\\compile_commands.json"
        }
    ],
    "version": 4
}

image

bobbrow commented 5 years ago

Can you run the "Log Diagnostics" command and share the output? That will print out which paths the extension eventually ended up using for your IntelliSense.

Gruntfuggly commented 5 years ago
-------- Diagnostics - 28/05/2019, 14:47:06
Version: 0.23.1
Translation Unit Mappings:
[C:\Users\nscott\workspace\asldev\aslcore\emcs\libemcscms\ArgumentsProcessor.cpp]:
    C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSCMS\ARGUMENTSPROCESSOR.CPP
Translation Unit Configurations:
[C:\Users\nscott\workspace\asldev\aslcore\emcs\libemcscms\ArgumentsProcessor.cpp]:
    Process ID: 14304
    Memory Usage: 10 MB
    Includes:
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSCMS
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSCMS
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSCMS\EMCSCMS_AUTOGEN\INCLUDE
        C:\W\BUILD_X86_DEBUG
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\CHECKEDCONNECT
        C:\W\BUILD_X86_DEBUG\P\CHECKEDCONNECT
        C:\W\BUILD_X86_DEBUG\X\SECURITYCACHE
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\SECURITYCACHE
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSSECURITY
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSSECURITY
        C:\W\BUILD_X86_DEBUG\X\ASL
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\ASL
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSCONFIG
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSCONFIG
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\ASLSMARTMESSAGEBOX
        C:\W\BUILD_X86_DEBUG\X\ASLSMARTMESSAGEBOX
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\STRINGUTIL
        C:\W\BUILD_X86_DEBUG\P\STRINGUTIL
        C:\W\BUILD_X86_DEBUG\P\STRINGLISTUTIL
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\STRINGLISTUTIL
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSDB
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSDB
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSLOG
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSLOG
        C:\W\BUILD_X86_DEBUG\JCOPISE-DVA-API
        C:\W\BUILD_X86_DEBUG\JCOPISE-DVA-API\GEN
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\DVA\PMC
        C:\W\BUILD_X86_DEBUG\X\DVA-API
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\DVA-API
        C:\W\BUILD_X86_DEBUG\JCOPISE-JCOP-INCLUDE
        C:\W\BUILD_X86_DEBUG\JCOPISE-JCOP-INCLUDE\GEN
        C:\W\BUILD_X86_DEBUG\X\INCLUDE
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\JCOP\INCLUDE
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\JABBERLIB\XMPP\SRC
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\JABBERLIB\CUTESTUFF
        C:\W\BUILD_X86_DEBUG\P\XMPP
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\JABBERLIB\XMPP
        C:\W\BUILD_X86_DEBUG\JPCTOOLS
        C:\W\BUILD_X86_DEBUG\JPCTOOLS\GEN
        C:\W\BUILD_X86_DEBUG\X\OPC
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\OPC
        C:\W\BUILD_X86_DEBUG\X\LIBJCOP
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\JCOP\LIBJCOP
        C:\W\BUILD_X86_DEBUG\P\LIBJPCTREECONFIG
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBJPCTREECONFIG
        C:\W\BUILD_X86_DEBUG\JCOPISE-EMCS-JCOP-API
        C:\W\BUILD_X86_DEBUG\JCOPISE-EMCS-JCOP-API\GEN
        C:\W\BUILD_X86_DEBUG\X\JCOP-API
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\JCOP-API
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSTABLE
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSTABLE
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\ASLSMARTDIALOG
        C:\W\BUILD_X86_DEBUG\X\ASLSMARTDIALOG
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\ASLSMARTFILEDIALOG
        C:\W\BUILD_X86_DEBUG\X\ASLSMARTFILEDIALOG
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\TABLECOLUMNFILTERWIDGET
        C:\W\BUILD_X86_DEBUG\X\TABLECOLUMNFILTERWIDGET
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\INPUTMASKCOMBOBOX
        C:\W\BUILD_X86_DEBUG\X\INPUTMASKCOMBOBOX
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\TEXTINPUTDIALOG
        C:\W\BUILD_X86_DEBUG\P\TEXTINPUTDIALOG
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\BUTTONICON
        C:\W\BUILD_X86_DEBUG\P\BUTTONICON
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\CHECKEDRESOURCE
        C:\W\BUILD_X86_DEBUG\P\CHECKEDRESOURCE
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSGUI
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSGUI
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\DATESELECTOR
        C:\W\BUILD_X86_DEBUG\X\DATESELECTOR
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\CALENDAR
        C:\W\BUILD_X86_DEBUG\X\CALENDAR
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\KEYBOARDDIALOG
        C:\W\BUILD_X86_DEBUG\X\KEYBOARDDIALOG
        C:\W\BUILD_X86_DEBUG\X\MD5SUM
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\MD5SUM
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\SEARCHBAR
        C:\W\BUILD_X86_DEBUG\P\SEARCHBAR
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\ASLWIDGETUTILS
        C:\W\BUILD_X86_DEBUG\P\ASLWIDGETUTILS
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSAPPDB
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSAPPDB
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSREDUNDANCY
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSREDUNDANCY
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON
        C:\W\BUILD_X86_DEBUG\X\GETOPT
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\ASL-COMMON\GETOPT
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\DVA\LIBSUPERVISORCLIENT
        C:\W\BUILD_X86_DEBUG\P\LIBSUPERVISORCLIENT
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSTREE
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSTREE
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE
        C:\W\BUILD_X86_DEBUG\P\LIBEMCSDATATRANSFER
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\EMCS\LIBEMCSDATATRANSFER
    Defines:
        _DEBUG
        UNICODE
    Forced Includes:
        C:\USERS\NSCOTT\WORKSPACE\ASLDEV\ASLCORE\CMAKE\ASL-CMAKE.H
    Standard Version: ms_c++latest
    IntelliSense Mode: msvc-x64
Total Memory Usage: 10 MB
Gruntfuggly commented 5 years ago

Looks like "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include" is missing?

bobbrow commented 5 years ago

I think I see the problem now. It's because you are using compile_commands.json and our extension doesn't have code to support looking up the older compiler (compile_commands doesn't list out the system header paths explicitly). If you happen to have a newer compiler available on your PC (e.g. the Visual Studio Build Tools SKU), you can set the compilerPath property to override what's in compile_commands.json and point us to the newer headers. But currently, we don't have another way around this problem.

Gruntfuggly commented 5 years ago

That's a shame - using compile_commands.json makes things so much simpler in all other respects. Unfortunately I'm a bit stuck with the compiler...

bobbrow commented 5 years ago

Actually, I think there is another way. Can you try setting C_Cpp.default.systemIncludePath and add the VS 10.0 path?

According to this document, it should be used instead of the compiler path. I'm not able to test this out right now so if you get to this before me, please let me know.

Gruntfuggly commented 5 years ago

That does seem to work. The only includes it doesn't now find are where they have this format: #include "./Bookmarks.h" it seems happy where the includes are in a subfolder, e.g. #include "database/IBookmarkStorage.h" but not when they are in the same folder.

Gruntfuggly commented 5 years ago

If you're wondering why we use the ./, it's because the project is huge and contains header files with the same names.

bobbrow commented 5 years ago

Is the extension not finding Bookmarks.h at all, or is it finding the wrong one? I would be surprised if using ./ made any difference. If you remove it (just as a test) you will get the same error, correct?

When you run the Log Diagnostics command where does the folder containing Bookmarks.h show up in the list (if at all)?

github-actions[bot] commented 3 years ago

This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog.

github-actions[bot] commented 4 months ago

This feature request has received enough votes to be added to our backlog.

ZivDero commented 4 months ago

As of right now, the extension seems to be able to handle MSVC version 6.3 (VS6). Includes appear to function properly. Issues: