clion调试时候debug总是出现变量optimized out
解决方案:
修改CMakeLists:
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”)