microsoft / vscode-cpptools

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

cannot open source file "corecrt.h" (dependency of "iostream") #1237

Closed Hanano-Yuuki closed 6 years ago

Hanano-Yuuki commented 6 years ago
* Operating System and version: windows10-1709
* VS Code version:1.18.0
* C/C++ extension version:0.14.2
today when I open vscode to edit my code it suggests me "cannot open source file "corecrt.h" (dependency of "iostream")"
but it worked well yesterday.
after I change the C_Cpp.intelliSenseEngine setting to Tag Parser.the problems disappear,but itelliSense cannot works as conveniently as my original settings(C_Cpp.intelliSenseEngine:Default)
using VS2015/VC/include or using MinGW/include are the same situation...
I wonder if I forget to add something into c_cpp_properties.json 
maybe this is not my fault because vsc worked well yesterday and the program can be run sucessfully

and this is my c_cpp_properties.json now:

{ "name": "Win32", "includePath": [ "C:/VS2015/VC/include/", "C:/VS2015/VC/atlmfc/include/", "C:/Program Files (x86)/Windows Kits/8.1/Include/um", "C:/Program Files (x86)/Windows Kits/8.1/Include/shared", "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt", "${workspaceRoot}" ], "defines": [ "_DEBUG", "UNICODE" ], "intelliSenseMode": "msvc-x64", "browse": { "path": [ "C:/VS2015/VC/include/", "C:/VS2015/VC/atlmfc/include/", "C:/Program Files (x86)/Windows Kits/8.1/Include/um", "C:/Program Files (x86)/Windows Kits/8.1/Include/shared", "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt", "${workspaceRoot}" ], "limitSymbolsToIncludedHeaders": true, "databaseFilename": "" } }

Hanano-Yuuki commented 6 years ago

the problem is solved,sorry for trouble caused

Zeta-lime commented 6 years ago

@Hanano-Yuuki ,hello , how did you solve this problem at last , I just have the same problem!

Hanano-Yuuki commented 6 years ago

@Zeta-lime I think it may help you: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md

by the way,run g++ -Wp,-v -E -xc -x c++ NUL to see the include files(if you use G++) and the order is important hope it can help you

Zeta-lime commented 6 years ago

Thank you this is exactly answer I am seek for!

发送自 Windows 10 版邮件应用

发件人: Hanano-Yuuki 发送时间: 2017年11月15日 23:17 收件人: Microsoft/vscode-cpptools 抄送: Phillins Lime; Mention 主题: Re: [Microsoft/vscode-cpptools] cannot open source file "corecrt.h"(dependency of "iostream") (#1237)

@Zeta-lime I think it may help you: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md by the way,run g++ -Wp,-v -E -xc -x c++ NUL to see the include files(if you use G++) and the order is important hope it can help you — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

zjplab commented 6 years ago

You fixed this problem by changing to gcc as the compiler...For someone choosing MSVC, I fixed the "cannot open source file "corecrt.h" (dependency of "iostream")" issue by changing the include path in _c_cppproperties.json

"D:/Program Files/Microsoft/MSVC2017/VC/Tools/MSVC/14.12.25827/include/*", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt", "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10240.0/ucrt/x64",

I installed MSVC on D: drive, you may change that according.

hudsontek commented 5 years ago

You fixed this problem by changing to gcc as the compiler...For someone choosing MSVC, I fixed the "cannot open source file "corecrt.h" (dependency of "iostream")" issue by changing the include path in _c_cppproperties.json

"D:/Program Files/Microsoft/MSVC2017/VC/Tools/MSVC/14.12.25827/include/*", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt", "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10240.0/ucrt/x64",

I installed MSVC on D: drive, you may change that according.

The last line does the job. You can omit the rest lines safely.