我在进行断点调试的时候newDemo was compiled with optimization - stepping may behave oddly; variables may not be available.
这种错误.再然后进行打印
error: Couldn't materialize: couldn't get the value of variable self: variable not available
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression
这种错误.为什么会出现这种错误?
newDemo was compiled with optimization - stepping may behave oddly
说的是编译的时候做了优化,所以源代码和编译后的机器码没办法一一对应,断点调试使用机器码,对应不到,所以self变量找不到。编译的时候不要选择 Release (发布)模式。