N/APosted on - 09/03/2016
I was writing a program for class using gedit as the text editor, coding in C++, and compiling with g++, but I am getting this error when I run it:
Segmentation fault (core dumped)
I want to know, what does it mean, what could be the probable reason, and how can it be solved?
Segmentation Fault Error in Linux While Compiling Program Codes
It basically means that the program is trying to access a memory area that it is not supposed to access. A segmentation fault is actually a symptom of a problematic pointer.
The default characteristic of Ubuntu is that despite the message, no core file is actually written. If you have something called a “core”, you can examine it using a debugger to find out where it has crashed.
A core file/core dump is a file that holds the complete memory image of a crashed process. The default settings of modern day Operating Systems generally have to be changed for a core to be written after a dump because, core dumps are just extra files cluttering the file system that the laymen don't know how to deal with at the end of the day.
There could also be a bug somewhere in the code, most likely involving a pointer. The first attempt to rectification whenever the Segmentation Fault error occurs is to double-check all the pointers in the code and their addresses. That will definitely take care of the aforementioned error.