質問

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