variables optimized out when debugging
已回答

just like the picture, some varibles are optimized out when debugging, but I'm confused what cause that? why I can't see this varible's value?
请先登录再写评论。
Hi!
On high optimization levels, the compiler can eliminate intermediate values, as you have seen here. Please see this stackoverflow discussion, for example. To change the optimization level, add the following commands to CMakeLists.txt file:
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
It worked! Thank you so much! happy new year!
Yes, Anna's method works.
But why is this not the default configuration? We are debugging!