Vscode-cpptools: Cannot open source file "locale.h"(dependency of "string")

Created on 29 Oct 2017  路  8Comments  路  Source: microsoft/vscode-cpptools

OS and toolset:
Windows 10 Pro x64
mingw-w64
Error
file: 'file:///c%3A/Users/likui/Documents/Source/02.cpp'
severity: 'Info'
message: 'cannot open source file "locale.h" (dependency of "string")'
at: '2,1'
source: ''
c_cpp_propieties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/*",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/*",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/*",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/tr1",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/tr1/*",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/*"

            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "path": [
                    "${workspaceRoot}",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/*",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/*",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/*",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/tr1",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/tr1/*",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/*"    
                ]
            },
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 3
}
Language Service question

Most helpful comment

Please update your includePath to match the output of gcc -v -E -x c++ -. Be sure to keep the same order too. Sorting the system include paths can have unintended consequences.

All 8 comments

Please update your includePath to match the output of gcc -v -E -x c++ -. Be sure to keep the same order too. Sorting the system include paths can have unintended consequences.

the output of gcc -v -E -x c++ -:

Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-6.3.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,lto --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw630/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw630/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw630/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw630/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw630/prerequisites/x86_64-zlib-static/include -I/c/mingw630/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw630/prerequisites/x86_64-zlib-static/include -I/c/mingw630/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw630/prerequisites/x86_64-zlib-static/include -I/c/mingw630/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64/opt/lib -L/c/mingw630/prerequisites/x86_64-zlib-static/lib -L/c/mingw630/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 6.3.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=core2' '-march=nocona'
 C:/mingw-w64/bin/../libexec/gcc/x86_64-w64-mingw32/6.3.0/cc1plus.exe -E -quiet -v -iprefix C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/ -D_REENTRANT - -mtune=core2 -march=nocona
ignoring duplicate directory "C:/mingw-w64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++"
ignoring duplicate directory "C:/mingw-w64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32"
ignoring duplicate directory "C:/mingw-w64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/backward"
ignoring duplicate directory "C:/mingw-w64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/6.3.0/include"
ignoring nonexistent directory "C:/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../include"
ignoring duplicate directory "C:/mingw-w64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed"
ignoring duplicate directory "C:/mingw-w64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/mingw630/x86_64-630-posix-seh-rt_v5-rev0/mingw64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++
 C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32
 C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/backward
 C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/include
 C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed
 C:/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/include
End of search list.

c_cpp_propieties.json

{
            "name": "Win32",
            "includePath": [
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/backward",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include",
                "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed",
                "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/include",
                "${workspaceRoot}"
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "path": [
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/backward",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include",
                    "C:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed",
                    "c:/mingw-w64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/include",
                    "${workspaceRoot}" 
                ]
            }

but now
cannot open source file "locale.h" (dependency of "iostream")

I'm using (32-bit MinGW version) and gcc start looking at C:/MinGW/lib/gcc/mingw32/6.3.0/ but also have this error. When using some stuff from or next not linked

Thanks that helped me

@likui911 does adding any of the "defines" mentioned here to your c_cpp_properties.json help? (Particularly, __GNUC__=6)

Thank you, @kamilr , just added path locale.h. That helped me :)

Thank you @bobbrow

Closing this issue due to long inactivity.

Was this page helpful?
0 / 5 - 0 ratings