i have
-----------------Code:<<<FILE1.CPP>>> #include <string> #include "Customer.h" using namespace std; //in a functino somewhere Customer * person1; char name[50]; cin.getline(name, 50); person1->setName(name); <<CUSTOMER.CPP>> #include "Customer.h" void Customer::setName(string x) { Name = x; }
this is giving me a seg fault, this code looks fine to me??
and this is all i get from gdb
Program received signal SIGSEGV, Segmentation fault.
0x00216a43 in std::string::assign () from /usr/lib/libstdc++.so.5
(gdb) where
#0 0x00216a43 in std::string::assign () from /usr/lib/libstdc++.so.5
#1 0x00215d26 in std::string:perator= () from /usr/lib/libstdc++.so.5
#2 0x08049149 in Customer::setAdd ()
#3 0x0804987a in FILE1::menu ()
#4 0x08048cdb in main ()
(gdb)
i found that when i go to do
cout << Name; (in setName functin)
that gives me a segfault./. so do i need to initialise it to something?



LinkBack URL
About LinkBacks
perator= () from /usr/lib/libstdc++.so.5


