How to use pretty debugging printers to see Eigen objects in QtCreator?

前端 未结 3 1043
误落风尘
误落风尘 2021-02-05 21:11

I am trying to see the contents of an Eigen vector in the Locals and Expressions window of the QtCreator:

3条回答
  •  感动是毒
    2021-02-05 21:34

    Works for me as expected. The output looks like

    vec (10 x 1), ColumnMajor   Eigen::VectorXd
        [0] 3.1400000000000001  double
        [1] 3.1400000000000001  double
        [2] 3.1400000000000001  double
        [3] 3.1400000000000001  double
        [4] 3.1400000000000001  double
        [5] 3.1400000000000001  double
        [6] 3.1400000000000001  double
        [7] 3.1400000000000001  double
        [8] 3.1400000000000001  double
        [9] 3.1400000000000001  double
    

    Make sure to use Qt Creator's own pretty-printing system by removing(!) the checkmark in Tools/Options/Debugger/GDB/Load system pretty printers. You also don't need the code you put into your .gdbinit in this case.

提交回复
热议问题