Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 4 odgovora
  • 3.078 pregleda

Najnovija ↓

Segmentation fault? 26.04.2010. u 18:55 · pre 201 mesec #1
Take a look at the following code:
Code:

typedef std::vector<unsigned int> VecUnsRAM;
VecUnsRAM myPos(vertices.size());
unsigned int count=0;
for(unsigned int j=0; j<vertices.size();++j) {
        myP t=std::make_pair(count, vertices[j].D);
    std::cout<<"Got here"<<std::endl;
    PQ[j]=t;
    std::cout<<"Got here"<<std::endl;
    myPos[j]=count;// or myPos[j]=j; produces Seg fault error
    std::cout<<"Got here"<<std::endl;
    ++count;
    
    }


The output is "Got here" twice, and then the Seg fault. Any ideas why this happens?
Thanks
Re: Segmentation fault? 26.04.2010. u 23:54 · pre 201 mesec #2
You can not send incomplete piece of code and expect any kind of answer. When asking a question try to create minimal COMPLETE program, that reproduces the error and send that code here. Than you can expect reasonable answer.

with this code I can only say this:

What type is used for vertices?
What is PQ?

What exactly are you trying to do with this code?
Potpis
Tko leti vrijedi
Re: Segmentation fault? 27.04.2010. u 22:29 · pre 201 mesec #3
cross posted: http://forums.devshed.com/c-pr...segmentation-fault-698764.html , http://cboard.cprogramming.com...126230-segmentation-fault.html
Potpis
Sveti Avgustin: "Dobar hrišćanin treba da se kloni matematičara i svih onih koji daju lažna proročanstva. Postoji opasnost da su matematičari već sklopili pakt sa Đavolom, da pomrače čovekov um i da ga okuju okovima pakla."
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme