VS 立即窗口“标识符未定义"使用命名空间查询 DLL 函数时 [英] VS immediate window "identifier undefined" when querying DLL functions w/ namespace

查看:44
本文介绍了VS 立即窗口“标识符未定义"使用命名空间查询 DLL 函数时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些 DLL 导出函数,我试图从 VS2017 即时窗口内部调用这些函数.C++ 头文件中的函数如下所示:

命名空间{bool MODEL_DECLSPEC ClearParameter();bool MODEL_DECLSPEC GetResult();:}

但是,当我在代码中的断点处停止并在即时窗口中键入时

ma::GetResult()

它回来了

 标识符ma"未定义

我可以在std"命名空间中调用函数,但不能在我自己的命名空间中调用?

我进行了更多测试,当我的断点位于 DLL 内的ma"命名空间范围内时,即时窗口可以很好地解释ma"命名空间并调用我导出的 DLL 函数.这对调试来说非常有限,所以我确定我遗漏了什么?

解决方案

发现它与命名空间无关.本机调试器不会查看其当前模块之外的内容:"立即窗口无法执行dll导出的函数"

讨论了一些解决方法这里

I have some DLL exported functions that I'm trying to call from inside of VS2017 immediate window. The functions in the C++ header look like this:

namespace ma
{
    bool MODEL_DECLSPEC ClearParameter();
    bool MODEL_DECLSPEC GetResult();
          :
}

However, when I stop at a breakpoint in my code and type into the immediate window

ma::GetResult()

It returns

 identifier "ma" is undefined

I can call functions in the "std" namespace but not in my own namespace?

EDIT: I did some more tests and the immediate window interprets the "ma" namespace fine and calls my exported DLL function when my breakpoint is within the "ma" namespace scope inside the DLL. That's pretty limiting for debugging, so I'm sure I'm missing something?

解决方案

Found out it had nothing to do with namespace. The native debugger won't look outside of its current module: "Immediate window can not execute a function exported by a dll"

There are some workarounds discussed here

这篇关于VS 立即窗口“标识符未定义"使用命名空间查询 DLL 函数时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆