作者fishxd1096 (费许差D)
看板C_and_CPP
标题[问题] CMake在vscode中debug出现错误
时间Sat Jun 19 16:42:36 2021
开发平台(Platform): (Ex: Win10, Linux, ...)
Linux
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
GCC
问题(Question):
我照着VSCODE官方的CMake Hello World教学操作,可以编译、可以执行,但是进行debug时出现错误。
(我不会用CMake,只知道是用来Build专案的工具,所以想透过这个hello world开始学习)
我选择的Kit
https://imgur.com/FNCF113
Build讯息
https://imgur.com/rwZKcCJ
可以在断点停下
https://imgur.com/ZQo2hgq
Debug讯息
https://imgur.com/sSEm6x5
但按下Step後就错误了
https://imgur.com/19nicB8
我在该路径应该放什麽档案吗?我的根目录没有build这个资料夹
https://imgur.com/BT7GIU4
我前阵子google了很久还是不知道怎麽解决,所以决定询问大家
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.174.74.29 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1624092158.A.1AC.html
1F:→ Sanvean: 你是用 Step in, Step out 还是 Step over? 我猜是用到 06/19 17:15
2F:→ Sanvean: Step in,然後进到没有 debug 资讯的 library 里了。 06/19 17:18
啊!确实是因为我按了Step in,我按了Step over就没问题了,天啊我被这个问题卡好久....
但想进一步问「进到没有debug资讯的library」是什麽意思?
我的猜测是standard library和我的hello world连结时,用的是非debug的obj,所以当我想step into时就会出现错误?
是这样吗?
※ 编辑: fishxd1096 (1.174.74.29 台湾), 06/19/2021 18:10:23
3F:推 Sanvean: 当你在 cout 那一行要 Step in 的时候应该会进到 06/19 18:31
4F:→ Sanvean: Standard Library,如果没有特别安装或自己编译,stdlib 06/19 18:33
5F:→ Sanvean: 不是没有 debug 资讯就是没有对应可以 debug 的原始码。 06/19 18:34
了解了,谢谢解答!
※ 编辑: fishxd1096 (1.174.74.29 台湾), 06/19/2021 18:45:24