c++引入了头文件没报错但是undefined reference to `info_manager::info_manager()‘

参考链接:
https://blog.csdn.net/qq_29750461/article/details/127972046?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EAD_ESQUERY%7Eyljh-1-127972046-blog-120460431.pc_relevant_landingrelevant&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EAD_ESQUERY%7Eyljh-1-127972046-blog-120460431.pc_relevant_landingrelevant&utm_relevant_index=2

错误原因:
vscode只编译了主函数的cpp文件,没有编译自己创建的cpp文件。

解决方案:
把该文件里的file改成file下面那一行,意思是编译该目录下的所有cpp文件。

{
	"version": "2.0.0",
	"tasks": [
		{	
			"type": "cppbuild",
			"label": "g++.exe build active file",
			"command": "D:/mingw64/bin/g++.exe",
			"args": [
				"-fexec-charset=GBK",
				"-fdiagnostics-color=always",
				"-g",
				//"${file}",
				"${fileDirname}\\*.cpp",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "D:/mingw64/bin"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "编译器: D:/mingw64/bin/g++.exe"
		},
	]
}```

你可能感兴趣的:(个人学习_研究生,c++,vscode,开发语言)