Important: Please read the Qt Code of Conduct -

QtApp Segmentation Fault [SOLVED]

  • Hi folks,
    There are 15 minutes ago my application was running smoothly and now she does not perform at all, the first line of running it gives segmentation fault and does not run. Be in Debug or Release mode, all return me segmentation. I have not changed the code, why is not working anymore?

  • Moderators

    Hi @Lays147,

    A segmentation fault is caused by a memory bug in your program. For example, you used an uninitialized pointer.

    Sometimes, the bug doesn't cause crashes, but sometimes it does.

    Use a Debugger to help you find the bug.

  • As @JKSH sais, a segmentation fault is caused by a memory bug in the program.

    For instance, the cause can be something like this:

    std::vector<double> myvector;
    myvector[2] = 22; //will cause segmentation fault since myvector[2] does not exist!

    running it with the Debugger causes the program to halt at the line which causes the segmentation fault, so in my example at myvector[2]=22;. This will help you solve your problem.

Log in to reply