在刷题的时候,使用万能头文件 #include,但是vscode无法识别,找不到头文件。
问题出在路径中没有这个文件,所以创建这个文件。
红波浪线报错
解决方案,亲测有效
在代码的头文件加入#include,右键转到定义
屏幕快照 2020-09-14 11.56.46.png
在打开的iostream文件上右键“在finder中显示”,找到该文件所在的文件夹(win系统同理)
屏幕快照 2020-09-14 12.20.23.png
在该文件夹下,新建一个txt文件,将名称改为stdc++.h,粘贴下面这段内容到里面,并将文件保存在此。
屏幕快照 2020-09-14 12.21.44.png
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2014 Free Software Foundation, Inc. This file is part of the GNU ISO C++ Library. This library is free// software; you can redistribute it and/or modify it under the// terms of the GNU General Public