关于 vscode 配置缺省源
  • 板块灌水区
  • 楼主hfjqwq
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/10/28 14:09
  • 上次更新2023/11/2 11:05:23
查看原帖
关于 vscode 配置缺省源
767295
hfjqwq楼主2023/10/28 14:09

下面是在 cpp.json 里面的配置:

{
    "ready": {
        "prefix": "ready",
        "body": [
            "#include<bits/stdc++.h>",
            "using namespace std;",
            "namespace sol{",
            "\tvoid main(){",
            "\t\t",
            "\t}",
            "}",
            "int main(){",
            "\tios::sync_with_stdio(false);",
            "\tcin.tie(nullptr);",
            "#ifndef DDEBUG",
            "\tfreopen("cin.in","r",stdin);",
            "#endif",
            "\tsol::main();",
            "\treturn 0;",
            "}"
        ],
    }
}

而在代码里面打出来是这样:

#include<bits/stdc++.h>
using namespace std;
namespace sol{
	void main(){
		
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
#ifndef DDEBUG
	freopen(
,
,stdin);
#endif
	sol::main();
	return 0;
}

中间的这个部分

#ifndef DDEBUG
	freopen("cin.in","r",stdin);
#endif

被解析成了

#ifndef DDEBUG
	freopen(
,
,stdin);
#endif

可能是 cpp.json 文件中的"\tfreopen("cin.in","r",stdin);",被解析成了什么奇怪的东西。

求解决方法。

2023/10/28 14:09
加载中...