# Revision history [back]

### Remove GCC optimizations

Hi, I'm trying to debug an issue with some code via GDB, but some values are apparently optimized away. How can I disable compiler optimization in CMakeLists.txt? I tried doing rosbuild_remove_compiler_flags(my_executable "-O2") and then rosbuild_add_compiler_flags(my_executable "-O0") but this doesn't appear to have done anything, according to the output of make VERBOSE=1 it's still using -O2. What am I doing wrong? (the correct answer is trying to debug a ROS node using GDB, clearly...)

 2 retagged

### Remove GCC optimizations

Hi, I'm trying to debug an issue with some code via GDB, but some values are apparently optimized away. How can I disable compiler optimization in CMakeLists.txt? I tried doing rosbuild_remove_compiler_flags(my_executable "-O2") and then rosbuild_add_compiler_flags(my_executable "-O0") but this doesn't appear to have done anything, according to the output of make VERBOSE=1 it's still using -O2. What am I doing wrong? (the correct answer is trying to debug a ROS node using GDB, clearly...)

 3 retagged

### Remove GCC optimizations

Hi, I'm trying to debug an issue with some code via GDB, but some values are apparently optimized away. How can I disable compiler optimization in CMakeLists.txt? I tried doing rosbuild_remove_compiler_flags(my_executable "-O2") and then rosbuild_add_compiler_flags(my_executable "-O0") but this doesn't appear to have done anything, according to the output of make VERBOSE=1 it's still using -O2. What am I doing wrong? (the correct answer is trying to debug a ROS node using GDB, clearly...)