I am compiling a program using CMake with several external libraries: Qt, OMP and Boost. However recently adding fields to a class declaration in a header file results in an instant segfault when running the compiled program. This seems similar to the problem discussed here and here and just as discussed there, cleaning the build directory and recompiling does work, but unlike both of them I am not using QMake but CMake so there is no explicit dependency_dir.
I am not sure what is causing this problem and how to fix it. A temporary fix is to simply keep cleaning the build directory after changing the header, but it's not really solving the core problem.
To make extra clear what happens:
vector<double> _doubletTranslationLong;
// This work fine
vector<double> _doubletTranslationLong2;
// if this (or anything else) is added in the header, the program
// compiles fine but crashes instantly for the same input that worked
// earlier until a clean build is done.