使用生成的父文件(lzz、vscode)进行 C++ 调试

问题描述 投票:0回答:1

我正在使用 lzz 从项目中的仅标头文件生成

.hpp
.cpp
文件。 (我们称他们为
.hpp_dev

CMake 用于将生成的文件构建到库中,然后链接到可执行文件。

当我在 vscode 调试配置下运行可执行文件时,错误和断点始终引用生成文件中的行。

是否可以将调试接口重新放到开发头文件中? (即在

.hpp_dev
中设置断点,在
.hpp_dev
文件中而不是在
.cpp
生成的实现中引用错误)

c++ visual-studio-code cmake vscode-debugger
1个回答
0
投票

lzz 预处理器工具有 4 个选项,它们实际上在不同的输出文件类型中生成

#line
指令:

... 
-hl Generate #line directives in the header file.
-sl Generate #line directives in the source file.
-il Generate #line directives in the inline file.
-tl Generate #line directives in the template file

生成的

#line
指令将vscode调试器引用回开发头,这解决了断点和运行时错误反馈。

© www.soinside.com 2019 - 2024. All rights reserved.