为了账号安全,请及时绑定邮箱和手机立即绑定

VS code中编写C++的头文件无法使用是什么原因?

VS code中编写C++的头文件无法使用是什么原因?

YEEMING 2019-05-18 10:52:18
工作区没有检测到错误终端显示信息如下:> Executing task in folder Codes: D:\MinGW\bin\g++.exe -g c:\Users\lenovo\Documents\Codes\exp9\9-2\main.cpp -o main.exe <d:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\lenovo\AppData\Local\Temp\ccv0rkaB.o: in function `main':c:/Users/lenovo/Documents/Codes/exp9/9-2/main.cpp:9: undefined reference to `Stack::Stack(int)'d:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/Users/lenovo/Documents/Codes/exp9/9-2/main.cpp:9: undefined reference to `Stack::~Stack()'collect2.exe: error: ld returned 1 exit status终端进程已终止,退出代码: 1终端将被任务重用,按任意键关闭。
查看完整描述

4 回答

?
onemoo

TA贡献883条经验 获得超454个赞

你这里显示的是链接错误,stack 没有被编译链接。

你看看有关的工程、任务什么的哪里没设置好吧...

查看完整回答
反对 回复 2019-08-10
?
Codeli

TA贡献6条经验 获得超2个赞

  终端被任务重用是正常情况,检查以下:

  1. tasks.json launch.json有没有配置好,一般是这种情况

  2. mingw 有没有安装好

  3. 目录有无读写权限

  4. 是否存在C盘

建议把文件存在D盘内,再试一下。

查看完整回答
反对 回复 2019-08-09
  • 4 回答
  • 0 关注
  • 7254 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信