c++ begginer segmentation fault
I am reading this book called "C++ How to Program" from Deitel and I am still a beginner in this. I know Java, so I am trying to get familiar with the C++ syntax and how it works.

My code is the following:

file >> gradebook_interface.h

    #include <string>
    //#include <unordered_map>
    using namespace std;
    
    //specifing interface
    
    class gradebook_interface
    {
    	public:
    		//constructor
    		gradebook_interface(string);
    		void reset_Coursename();
    		void setCoursename(string);
    		string getCourseName();
    		void displayMessage();
    		void add_to_hashmap(string,int);
    	
    	private:
    		//hashmap init
    		//unordered_map <string, int> course_map;
    		string courseName;
    };

file >> gradebook_interface.cpp

    #include <iostream>
    //including interface "gradeinterface"
    #include "gradebook_interface.h"
    
    using namespace std;
    
    	//constructor from interface
    	gradebook_interface::gradebook_interface(string name)
    	{
    		setCoursename(name);
    	}
    
    	void gradebook_interface::setCoursename ( string name )
    	{
    		courseName = name;
    	}
    	
    	string gradebook_interface::getCourseName()
    	{
    		return courseName;
    	}
    
    	void gradebook_interface::displayMessage()
    	{
    		cout << "First C++ application\n" << getCourseName() << "!" << endl;
    	}
    
    	//interfac's methods
    	void gradebook_interface::reset_Coursename()
    	{	
    		courseName = "null";
    		cout << "The course name has been reseted! Value is: " << getCourseName() << endl;
    	}
    
    	void gradebook_interface::add_to_hashmap(string, int)
    	{
    		//course_map["test_course"] = 14;
    		//cout << "Hashmap value just entered:" << endl;
    		//cout << course_map["test_course"] << endl;
    		
    	} 

file >> gradebook_main.cpp

    #include <iostream>
    #include "gradebook_interface.h"
    
    using namespace std;
    
    int main()
    {
    	gradebook_interface gradebook_1 ("Maths");
    	gradebook_interface gradebook_2 ("Greek");
    
    	cout << "gradebook 1 " << gradebook_1.getCourseName() << endl;
    	cout << "gradebook 2 " << gradebook_2.getCourseName()  << endl;
    
    };
	
The book uses Visual Studio that I can't use because I am on ubuntu.
I read somewhere that if you compile C++ code using "gcc" it invokes automatically "g++".
But I get an error, so I am forced to use g++.
My first question is, can I use gcc (any parameters needed?)?
My second question is, how does the linker works?
My third question is why do I get a segmentation fault when I try to run this ??

thanks	 
c++ begginer segmentation fault
===

I am reading this book called "C++ How to Program" from Deitel and I am still a beginner in this. I know Java, so I am trying to get familiar with the C++ syntax and how it works.

My code is the following:

file >> gradebook_interface.h

    #include <string>
    //#include <unordered_map>
    using namespace std;
    
    //specifing interface
    
    class gradebook_interface
    {
    	public:
    		//constructor
    		gradebook_interface(string);
    		void reset_Coursename();
    		void setCoursename(string);
    		string getCourseName();
    		void displayMessage();
    		void add_to_hashmap(string,int);
    	
    	private:
    		//hashmap init
    		//unordered_map <string, int> course_map;
    		string courseName;
    };

file >> gradebook_interface.cpp

    #include <iostream>
    //including interface "gradeinterface"
    #include "gradebook_interface.h"
    
    using namespace std;
    
    	//constructor from interface
    	gradebook_interface::gradebook_interface(string name)
    	{
    		setCoursename(name);
    	}
    
    	void gradebook_interface::setCoursename ( string name )
    	{
    		courseName = name;
    	}
    	
    	string gradebook_interface::getCourseName()
    	{
    		return courseName;
    	}
    
    	void gradebook_interface::displayMessage()
    	{
    		cout << "First C++ application\n" << getCourseName() << "!" << endl;
    	}
    
    	//interfac's methods
    	void gradebook_interface::reset_Coursename()
    	{	
    		courseName = "null";
    		cout << "The course name has been reseted! Value is: " << getCourseName() << endl;
    	}
    
    	void gradebook_interface::add_to_hashmap(string, int)
    	{
    		//course_map["test_course"] = 14;
    		//cout << "Hashmap value just entered:" << endl;
    		//cout << course_map["test_course"] << endl;
    		
    	} 

file >> gradebook_main.cpp

    #include <iostream>
    #include "gradebook_interface.h"
    
    using namespace std;
    
    int main()
    {
    	gradebook_interface gradebook_1 ("Maths");
    	gradebook_interface gradebook_2 ("Greek");
    
    	cout << "gradebook 1 " << gradebook_1.getCourseName() << endl;
    	cout << "gradebook 2 " << gradebook_2.getCourseName()  << endl;
    
    };
	
The book uses Visual Studio that I can't use because I am on ubuntu.
I read somewhere that if you compile C++ code using "gcc" it invokes automatically "g++".
But I get an error, so I am forced to use g++.
My first question is, can I use gcc (any parameters needed?)?
My second question is, how does the linker works?
My third question is why do I get a segmentation fault when I try to run this ??

thanks	 