库内发生哪行异常

Which line exception occured inside a library

本文关键字:异常      更新时间:2023-10-16

我使用armadillo库。 在某处我得到这个异常:

error: Mat::init(): size is fixed and hence cannot be changed
terminate called after throwing an instance of 'std::logic_error'
  what():  Mat::init(): size is fixed and hence cannot be changed
Aborted (core dumped)

我知道为什么。但我不知道在哪里。

有没有办法获得导致此问题的行? valgrind或任何其他工具能够做到这一点吗?

更新:

编译代码:

g++ -g  -Wall -Wfatal-errors -Wextra -std=c++11 
            main.cpp -lboost_filesystem -lboost_system

你能在出现错误的地方发布一小段代码吗?我有类似的错误,但不记得是什么原因造成的,但尝试将命令的结果存储在其他变量中并检查它。并输入"cout"以查找导致错误的语句。