I have several maps containing a multitude of classes in my VC++ project, some of them default constructable, others not. When trying to build, I get a “no appropriate default constructor available” error. The problem is that the error is listed to occur in line 173 of map.cpp, which is the code for operator[]. It would seem that I’m accidentally calling operator[] (which implicitly calls the mapped type’s default constructor) on one of my non-default constructable maps, but VS doesn’t give me any info on where the error originated.
How can I find the part in my code that’s causing this problem?
You’re probably looking inside the error list window. Which I don’t use that often for C++ projects.
Go to the output window and check a little further down, you should be able to double click the line that will bring you to the type in question.
Doing a search for
: errorinside the output window is very common for me as well as: fatalto find the source of the errors. Also if you have C++ keyboard shortcuts setup you can keep hittingF4to go down the list of errors.To reset to the default C++ keyboard mappings:
Options -> Environment -> KeyboardThen reset keyboard mappings to:
Visual C++ 6.