See reply below for code to easily repro
Intellisense seems to ignore certain std members unless I specify using namespace std
Example:
#include <unordered_map>
struct Font
{
/* ...other members... */
std::unordered_map< int, Glyph > glyphList;
};
This does not work, and VSCode will claim in my .cpp file: class "Render::Font" has no member "glyphList"
Intellisense will work for every other member in the Font struct except glyphList.
If I change the code to the following, it works perfectly fine:
#include <unordered_map>
using namespace std;
struct Font
{
/* ...other members... */
unordered_map< int, Glyph > glyphList;
};
By including using namespace std and removing std:: from the front of unordered_map, intellisense will correctly recognize glyphList as a member of Font.
Oddly enough, other std members such as std::string work fine and are properly recognized by intellisense without having to use the above workaround:
struct Font
{
std::string filename; // works fine
std::unordered_map< int, Glyph > glyphList; // not recognized as a member of Font by intellisense
};
Additionally, this will also happen if I'm including a container's header within another included file, even with the above workaround:
#include "Base.h" // contains #include <vector>
using namespace std;
struct Parts
{
vector< int > slices; // not recognized
};
This is fixed by adding #include <vector> to the file, however not doing so still produces perfectly valid code with g++, with not even a warning. It appears as if intellisense is not recognizing includes within other included files. It however does not complain that vector is undefined, so clearly it recognizes it to some extent.
This is with "C_Cpp.intelliSenseEngine": "Default" turned on.
I'm running VSCode 1.14.2, cpptools 0.12.1, and Arch Linux.
See reply below for code to easily repro
Intellisense seems to ignore certain
stdmembers unless I specifyusing namespace stdExample:
This does not work, and VSCode will claim in my .cpp file:
class "Render::Font" has no member "glyphList"Intellisense will work for every other member in the
Fontstruct except glyphList.If I change the code to the following, it works perfectly fine:
By including
using namespace stdand removingstd::from the front ofunordered_map, intellisense will correctly recognizeglyphListas a member ofFont.Oddly enough, other
stdmembers such asstd::stringwork fine and are properly recognized by intellisense without having to use the above workaround:Additionally, this will also happen if I'm including a container's header within another included file, even with the above workaround:
This is fixed by adding
#include <vector>to the file, however not doing so still produces perfectly valid code with g++, with not even a warning. It appears as if intellisense is not recognizing includes within other included files. It however does not complain thatvectoris undefined, so clearly it recognizes it to some extent.This is with
"C_Cpp.intelliSenseEngine": "Default"turned on.I'm running VSCode 1.14.2, cpptools 0.12.1, and Arch Linux.