I'm writing a simple C++ code:
#include <iostream>
int get_change(int m) {
int n;
//write your code here
return n;
}
int main() {
int m;
std::cin >> m;
std::cout << get_change(m) << '\n';
}
Here is my c_cpp_properties.json :
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/include",
"C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/include-fixed",
"C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/include",
"C:/tools/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++",
"C:/tools/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32",
"C:/tools/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/backward",
"C:/tools/mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/include",
"C:/tools/mingw64/include",
"C:/tools/mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/include-fixed"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:/tools/mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/include",
"C:/tools/mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/include-fixed",
"C:/tools/mingw64/include/*"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
Here is the output I get by running g++ -Wp,-v -E -xc -x c++ - :
C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/include
C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/include-fixed
C:/tools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/include
C:/tools/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++
C:/tools/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32
C:/tools/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/backward
(which I have included in the include Path)
After including these locations, the green line under #include <iostream> is gone, but now I get 2 new errors:
namespace "std" has no member "cin" (11,8)
namespace "std" has no member "cout" (12,8)
PS. Also to note that I installed MinGW using choco package manager
Using this document as a reference, I see two problems with that config:
intellisenseMode should be clang-x64defines are missing. Copy in the missing ones from the document linked above.Closing this issue due to long inactivity.
Most helpful comment
Using this document as a reference, I see two problems with that config:
intellisenseModeshould beclang-x64definesare missing. Copy in the missing ones from the document linked above.