I am writing a C++ code in the ROOT platform. I am getting the following error:

*** Break *** segmentation violation
gdb not found, need it for stack trace
Root > Function main() busy flag cleared

I just want to know what this means (in general).

有帮助吗?

解决方案

Typically that means you have written to (or maybe read) memory you don't have permission on. Either it's just invalid memory or (if the platform supports such a concept) it's outside of the memory you own.

A common cause of this is freeing a pointer but then using it again.

Foo * pFoo = new Foo();
pFoo->Bar(); // should be fine.
delete pFoo; // pFoo now points to memory that may or may not still be an actual Foo.
pFoo->Bar(); // undefined behavior.

其他提示

Generally, "segmentation violation" means you accessed a piece of memory that wasn't allocated to you. Usually a stray pointer is the reason for that.

The remaining is some Linux-specific message concerning a missing gdb (which would be helpful to understand the problem).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top