Vscode-cpptools: PCH warning: header stop cannot be in a linkage block.

Created on 22 Mar 2019  路  5Comments  路  Source: microsoft/vscode-cpptools

Type: LanguageService

Describe the bug

I'm keep receiving this warning in several files of my project. Have no idea why this happens, see no correlation with anything. Do not even understand what's "header stop" and "linkage block".

For one file it happens randomly: open - no warning, open later - warning, open later - warning first shown then dissapears after 2 seconds.
For other file it's always there.

Haven't seen this warning before last update of c++ extension.

  • OS and Version: Windows 10 x64
  • VS Code Version: 1.32.3
  • C/C++ Extension Version: 0.22.1

To Reproduce


c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "defines": [
                "USBCON"
            ],
            "includePath": [
                "C:\\Program Files (x86)\\Arduino\\tools\\**",
                "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\include\\**",
                "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**",
                "${workspaceFolder}\\**"
            ],
            "intelliSenseMode": "msvc-x64",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

target file (qsort.h)

template<typename T>
class QSort {
    static T partition(T* A, int p, int q);
    static void swap(T& a, T& b);
public:
    static void sort(T* A, int p, int q);
};

template<typename T>
void QSort<T>::sort(T* A, int p, int q) {
    T r;

    if (p < q) {
        r = partition(A, p, q);
        sort(A, p, r);  
        sort(A, r + 1, q);
    }
}

template<typename T>
T QSort<T>::partition(T* A, int p, int q) {
    T pivot = A[p];
    int i = p;

    for(int j = p + 1; j < q; j++) {
        if(A[j] <= pivot) {
            i = i + 1;
            swap(A[i], A[j]);
        }

    }

    swap(A[i], A[p]);
    return i;
}

template<typename T>
void QSort<T>::swap(T& a, T& b) {
    T tmp = a;
    a = b;
    b = tmp;
}

Do not see warning when using same file in another project. Probably reason is not in this file.

pch_warnin

Feature Request Language Service more info needed

Most helpful comment

Note: we will probably suppress these PCH warnings in a future release.

All 5 comments

This warning is part of the new IntelliSense cache feature introduced in version 0.22.0. IntelliSense will auto generate precompiled headers (PCH) if there are any #include header files that it can cache. The cache is supposed to improve IntelliSense processing.

This feature can be disabled by setting C_Cpp.intelliSenseCacheSize to 0.

Note: we will probably suppress these PCH warnings in a future release.

I am having the same issue with some files in my projects. So what is a linkage block?

@jackxujh I think a linkage block means something like extern "C" {}.

We're unable to reproduce this problem with the information provided. If you continue to have this issue, please share a small project that exhibits the problem and we can investigate further. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thndrwrks picture thndrwrks  路  3Comments

DemoCrazer picture DemoCrazer  路  3Comments

arl picture arl  路  3Comments

montery8 picture montery8  路  3Comments

SkyRiderMike picture SkyRiderMike  路  3Comments