簡體   English   中英

在 Visual Studio 的立即窗口中訪問“cmath”函數

[英]Accessing 'cmath' functions in the Immediate Window of Visual Studio

在使用調試器的 Visual Studio 2010 Express 中,我可以輸入成員函數,例如:

?visc(alpha,i)  
8.2814899360436612e-005
?get_sign()
0.91513417241239037

進入立即窗口,它們工作正常。 但是,如果我嘗試:

?sin(alpha)
?math.sin(alpha)
?cmath.sin(alpha)

我收到Error: symbol "math" not found等等。 我已將cmath.h包含在主文件中,並在整個代碼中使用sinasincosacosatan2sqrt 如何在即時窗口中獲得這些功能? 我在 google 上搜索了我的問題,發現了一個在 2005 年添加的請求和使用成員函數的示例。

聽起來不直接支持: http : //connect.microsoft.com/VisualStudio/feedback/details/283279/add-simple-maths-function-support-to-debugger-exp-sin-cos-sqrt

不過,我想如果你知道正確的 dll,你可以使用幾乎沒有記錄的 Context Operator 來獲取它(這是我本周第二次看到這個人的博客): http://thetweaker .wordpress.com/2009/05/30/break-on-system-functions-with-the-context-operator/

類似問題的答案: https : //stackoverflow.com/a/3032271/611672

希望這可以幫助。

只有一些導出的 dll 函數在 Visual Studio 即時窗口中工作。 一些最常見的函數如 sin、cos、pow、exp 不起作用。 以下是一些在 Visual Studio 2012 中經過測試的工作功能:

msvcp110d.dll!log(2.0)
0.69314718055994529
msvcr110d.dll!sqrt(2.0)
1.4142135623730951
msvcr110d.dll!_hypot(-2.0,1.0)
2.2360679774997898
msvcr110d.dll!_logb(-2.0)
1.0000000000000000
msvcr110d.dll!abs(-2.0)
2.0000000000000000
msvcr110d.dll!acos(-2.0)
-1.#IND000000000000
msvcr110d.dll!cosh(1)
1.5430806348152437
msvcr110d.dll!fabs(1)
1.0000000000000000

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM