“Function has no address” despite disabled optimization (/Od)

戏子无情 提交于 2019-12-22 02:32:32

问题


During debug in MSVC 2012, I am attempting to call some functions from the Watch window in order to dump data to files. However, I keep getting this error:

Function Matrix::Save has no address, possibly due to compiler optimizations.   

The class Matrix is located in my own external library. A quick check showed that none of the methods in external libraries have addresses and all attempts to call them from Watch return this error, except for those which are defined in the header files. The methods in the main project all have addresses regardless of where they are defined.

Optimization is disabled throughout the solution, of course. Symbols are loaded normally. How do I fix it?


回答1:


So far, I found a workaround in building the external library statically. With statically linked libraries, the addresses of methods are found. Configuration manager allows keeping dynamic libraries for the Release easily.




回答2:


As a simpler woraround, you can call target function(Matrix::Save) at least one time in current code branch. Then it will have an address because it is used.



来源:https://stackoverflow.com/questions/27300112/function-has-no-address-despite-disabled-optimization-od

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!