I'm writing a lesson code from a C++ for dummies book and ran into this error.
/*
        CallMemberFunction - define and invoke a function
                             that a member of the class Student
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
class Student
{
 public:
     // add a completed course to the record
     double addCourse(int hours, double grade)
     {
       // calculate the sum of all courses times
       // the average grade
       double weightedGPA;
       weightedGPA = semesterHours * gpa;
       // now add in the new course
       semesterHours += hours;
       weightedGPA += grade * hours;
       gpa = weightedGPA / semesterHours;
       // return the new gpa
       return gpa;
     }
  int semesterHours;
  double gpa;
};
int main(int nNumberofArgs, char* pszArgs[])
{
    // create a Student object and initialize it
    Student s;
    s.semesterHours = 3;
    s.gpa = 3.0;
    // the values before the call
    cout << "Before: s = (" << s.semesterHours
         << ", " << s.gpa << ")" << endl;
    // the following subjects the data members of the s
    // object to the member function addCourse()
    cout << "Adding 3 hours with a grade of 4.0" << endl;
    s.addCourse(3, 4.0); // call the member function
    // the values are now changed
    cout << "After: s = (" << s.semesterHours
         << ", " << s.gpa << ")" << endl;
    // wait until user is ready before terminating program
    // to allow the user to see program results
    cout << "Press Enter to continue...." << endl;
    cin.ignore(10,'\n');
    cin.get();
    return 0;
}
||=== Build: Debug in CallMemberFunction (compiler: GNU GCC Compiler) ===|
||error: ld returned 1 exit status|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I started this on a windows 11 home laptop and then tried to compile it on a windows 11 pro computer and ran into this problem. I added these two compiler flags to the IDE -static-libgcc -static-libstdc++ and still getting this error, any help greatly appreciated. 
			
			
			
				error: ld returned 1 exit status
  is usually fixed by reinstalling the compiler. Here's (https://forums.codeblocks.org/index.php/topic,22801.0.html) others who got the same error.