I was wandering what could be the causes of this error message? Like in general.\\: *stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x00402d53",func="Domain::Movie::show",args=[{name="this",value="0x1"}],file="..\\src\\Domain\\Movie.cpp",fullname="e:\\eclipse for c++\\workspace\\lb6-8oop\\src\\domain\\Movie.cpp",line="36"},thread-id="1",stopped-threads="all"
10x.
Lucaci Andrew
140
Za s|n
Recommended Answers
Jump to PostHere's your problem:
int main(){ D* d; d->add();
You've declared
D* d
, but you never assign it a value. It could be pointing anywhere. Then you go and try to use this uninitialized pointer. That is an excellent way to get a segfault.I compiled …
Jump to PostWhen you get to it,
void B::add(int id, string name, int age){ A *a; a=new A; a->setid(id); a->setname(name); a->setage(age); list.push_back(*a); }
is leaking memory.
You define list asvector<A> list;
and in the add function allocate memory for an A class but when you add …
All 7 Replies
mitrmkar
1,056
Posting Virtuoso
Lucaci Andrew
140
Za s|n
gusano79
247
Posting Shark
Lucaci Andrew
140
Za s|n
DeanMSands3
69
Junior Poster
histrungalot
32
Junior Poster
DeanMSands3
commented:
Good call!
+4
gusano79
247
Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.