在mingw14.2版本中, print库的功能默认没有开启, 生成可执行文件的tasks.json里要显式加-lstdc++exp, 注意放置顺序. 

tasks.json (支持mingw g++14.2 c++23的print )

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++.exe build",
			"command": "D:\\code\\sfml3_0\\mingw64_1420\\bin\\g++.exe",
			"args": [
				"-std=c++23",
				"-fdiagnostics-color=always",
				"-g",
				"*.cpp",
				"-lstdc++exp" //注意放置顺序一定要放到最下面,系统Path也要配置.
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "编译器: D:\\code\\sfml3_0\\mingw64_1420\\bin\\g++.exe",
			"presentation": {
				"reveal": "silent",
				"revealProblems": "onProblem",
				"close": true
			}
		}
	]
}

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐