Undefined symbols for architecture x86_64: (linker issue?) - c++

I'm doing the following problem :
Add on to your Rectangle class from last time:
1)Create a new class TestRect which is a friend class of Rectangle. Inside this class, implement a member function called TestRect::tester, which takes a rectangle as a parameter and tests that both length and width are > 0.
2)Create a main() function which makes three rectangles r1, r2, and r3, each of which has length and width 20. Then call your TestRect::tester function on each of these rectangles and print out the result
I think I did part 1) correctly but part 2) does not give me the output I'm looking for. I do not know how to fix my code from the following output I got :
cppcompile rectEnhanceStaticFriends
Undefined symbols for architecture x86_64:
"TestRect::tester(Rectangle&)", referenced from:
_main in rectEnhanceStaticFriends.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
cppcompile:15: no such file or directory: ./rectEnhanceStaticFriends
Can you help me how to fix it? Seems a linker issue, that I did not find how to fix it. Thank you for reading through. (Ps: I compile with VSC)
Here is my code :
rectEnhanceStaticFriends.cpp
#include <iomanip>
#include <cstring>
#include <string>
#include "rect.h"
using namespace std;
int main()
{
Rectangle::setYards(100);
Rectangle r1(20, 20, "Kitchen");
Rectangle r2(20, 20, "Bathroom");
Rectangle r3(20, 20, "Office");
TestRect tr;
cout << "Test on r1: " << tr.tester(r1) << endl;
cout << "Test on r2: " << tr.tester(r2) << endl;
cout << "Test on r3: " << tr.tester(r3) << endl;
Rectangle house[] = {Rectangle(10, 12, "Kitchen"),
Rectangle(20, 20, "Bedroom"),
Rectangle(8, 12, "Offce")};
for (int i = 0; i < 3; i++)
{
if (strcmp(house[i].printName(), "Offce") == 0)
{
// cout << "oui\n";
house[i].setName("Office");
};
cout << "Area for " << house[i].printName() << " is : " << house[i].getArea() << endl;
}
if (house[1].getArea() > house[2].getArea() && house[1].getArea() > house[3].getArea())
{
cout << house[1].printName() << " has the biggest area.\n";
}
else if (house[2].getArea() > house[1].getArea() && house[2].getArea() > house[3].getArea())
{
cout << house[2].printName() << " has the biggest area\n";
}
else
{
cout << house[3].printName() << " has the biggest area\n";
}
//there is an error house[3] go beyond the array..
return 0;
}
testRect.h
#ifndef TESTRECT_H
#define TESTRECT_H
class Rectangle; //forward declaration of class Rectangle
class TestRect
{
public:
bool tester(Rectangle &);
};
#endif
testRect.cpp
#include <iostream> //
#include <iomanip>
#include <string>
#include "testRect.h"
#include "rect.h"
bool TestRect::tester(Rectangle &r)
{
bool testResult = false;
if (r.width > 0 && r.length > 0)
testResult = true;
return testResult;
}
rect.h
// Rec header file
#ifndef RECT_H
#define RECT_H
#include "testRect.h"
class Rectangle
{
private:
double width;
double length;
char *name;
static double yardsAvail; //indicate how many yards of perimeter are available to make rectangle
void initName(const char *n);
void initName(const char *n, int size);
public:
//constructors
Rectangle();
Rectangle(double, double,
const char *);
//destructor
~Rectangle() { delete[] name; };
void setWidth(double);
void setLength(double);
void setWidth(char *);
void setLength(char *);
void setName(const char *);
int getWidth() const;
int getLength() const;
double getArea() const;
char *printName() const
{
return name;
}
//added parts
static void setYards(double);
friend class TestRect;
friend bool TestRect::tester(Rectangle &);
};
double Rectangle::yardsAvail = 0; //added parts
#endif
rect.cpp
#include <iostream> //
#include <iomanip>
#include <string>
#include "rect.h"
#include "testRect.h"
using namespace std;
Rectangle::Rectangle()
{
width = 0;
length = 0;
initName("Default");
}
Rectangle::Rectangle(double x, double y, const char *z)
{
width = x;
length = y;
initName(z);
double yardsReqd = 2 * x + 2 * y;
if (yardsAvail - yardsReqd < 0)
{
cout << "Not enough yard..\n";
width = 0;
length = 0;
}
yardsAvail -= yardsReqd;
}
void Rectangle::initName(const char *n)
{
name = new char[258];
strcpy(name, n);
};
void Rectangle::initName(const char *n, int size)
{
name = new char[size];
strcpy(name, n);
};
void Rectangle::setWidth(double w)
{
width = w;
}
void Rectangle::setLength(double l)
{
length = l;
}
void Rectangle::setName(const char *newname)
{
//newname.newName = "Office";
strcpy(name, newname);
}
double Rectangle::getArea() const
{
return width * length;
}
//added part
void Rectangle::setYards(double y)
{
yardsAvail = y;
}

Related

Why is there a 'Vehicle':base class undefined error coming up?

Vehicle class is an abstract base class for ElectricVehicle and GasolineVehicle classes, and HybridVehicle class inherits from ElectricVehicle and GasolineVehicle.
I have two 'Vehicle':base class undefined errors in ElectricVehicle.h and GasolineVehicle.h. I know I am messing up the #include files somehow, but I'm having trouble figuring that out.
I tried removing the Vehicle.cpp in ElectricVehicle.cpp and GasolineVehicle.cpp and adding the Vehicle header file, but that came up with a bunch of other errors.
Vehicle.h
#pragma once
#ifndef Vehicle_h
#define Vehicle_h
class Vehicle {
public:
// check here // 4 lines
float engineEfficiency;
virtual float calculateRange() = 0;
virtual float percentEnergyRemaining() = 0;
virtual void drive(float) = 0;
virtual ~Vehicle();
};
#endif
Vehicle.cpp
#pragma once
#include "Vehicle.h"
#include <iostream>
using namespace std;
Vehicle::~Vehicle() {
cout << "In vehicle destructor" << endl;
}
ElectricVehicle.h
#pragma once
#include <iostream>
#ifndef ElectricVehicle_h
#define ElectricVehicle_h
class ElectricVehicle : virtual public Vehicle {
public:
float maximumCharge;
float currentCharge;
float engineEfficiency;
public:
ElectricVehicle(float max, float eff);
float calculateRange();
float percentEnergyRemaining();
void drive(float km);
~ElectricVehicle();
};
#endif
ElecticVehicle.cpp
#pragma once
#include "Vehicle.cpp"
#include "ElectricVehicle.h"
using namespace std;
ElectricVehicle::ElectricVehicle(float maxEnergy, float rating) {
engineEfficiency = rating;
maximumCharge = maxEnergy;
currentCharge = maxEnergy;
}
ElectricVehicle::~ElectricVehicle() {
cout << "In Electric vehicle destructor" << endl;
}
float ElectricVehicle::calculateRange() {
return (currentCharge * 100 / engineEfficiency);
}
float ElectricVehicle::percentEnergyRemaining() {
return (currentCharge * 100.0f / maximumCharge);
}
void ElectricVehicle::drive(float km) {
if (currentCharge < 0) {
cout << "Your Car is out of energy";
return;
}
currentCharge -= (km / 100) * engineEfficiency;
}
GasolineVehicle.cpp
#include "Vehicle.cpp"
#include "GasolineVehicle.h"
using namespace std;
GasolineVehicle::GasolineVehicle(float maxEnergy, float rating) {
engineEfficiency = rating;
maximumGasoline = maxEnergy;
currentGasoline = maxEnergy;
}
GasolineVehicle::~GasolineVehicle() {
cout << "In Gasoline vehicle destructor" << endl;
}
float GasolineVehicle::calculateRange() {
return currentGasoline * 100 / engineEfficiency;
}
float GasolineVehicle::percentEnergyRemaining() {
return (currentGasoline * 100.0f / maximumGasoline);
}
void GasolineVehicle::drive(float km) {
if (currentGasoline < 0){
cout << "Your Car is out of energy";
return;
}
currentGasoline -= (km / 100) * engineEfficiency;
}
Gasoline.h
#pragma once
#include <iostream>
#ifndef GasolineVehicle_h
#define GasolineVehicle_h
class GasolineVehicle : virtual public Vehicle {
public:
float maximumGasoline;
float currentGasoline;
float engineEfficiency;
GasolineVehicle(float max, float eff);
~GasolineVehicle();
float calculateRange();
float percentEnergyRemaining();
void drive(float km);
};
#endif
HybridVehicle.cpp
#pragma once
#include "ElectricVehicle.h"
#include "GasolineVehicle.h"
#include "HybridVehicle.h"
#include<iostream>
using namespace std;
// hybridvehicle constructor is calling its parent class constructors;
HybridVehicle::HybridVehicle(float maxGasoline, float gasefficiency, float maxcharge, float electricefficiency) :GasolineVehicle(maxGasoline, gasefficiency), ElectricVehicle(maxcharge, electricefficiency) {}
HybridVehicle::~HybridVehicle() {
cout << "In Hybrid vehicle destructor" << endl;
}
// :: is scope resolution operator as both gasoline and electric vehicle classes having engine efficiency the compiler
// will be confused of which variable to take.. so we :: to remove ambuiguity
float HybridVehicle::calculateRange() {
return (currentCharge / ElectricVehicle::engineEfficiency) * 100 + (currentGasoline / GasolineVehicle::engineEfficiency) * 100;
}
float HybridVehicle::percentEnergyRemaining() {
return ((currentCharge + currentGasoline) / (maximumCharge + maximumGasoline)) * 100.0f;
}
void HybridVehicle::drive(float km) {
if (currentGasoline + currentCharge < 0) {
cout << "Your Car is out of energy";
return;
}
else if (currentCharge > 0) {
currentCharge -= (km / 100) * ElectricVehicle::engineEfficiency;
}
else
{
currentGasoline -= (km / 100) * GasolineVehicle::engineEfficiency;
}
}
HybridVehicle.h
#pragma once
#ifndef HybridVehicle_h
#define HybridVehicle_h
class HybridVehicle: public GasolineVehicle, public ElectricVehicle {
public:
HybridVehicle(float gMax, float gEff, float eMax, float eEff);
~HybridVehicle();
float calculateRange();
float percentEnergyRemaining();
void drive(float km);
};
#endif
Week2.cpp
#pragma once
#include "Vehicle.cpp"
#include "HybridVehicle.cpp"
using namespace std;
Vehicle* testVehicle(Vehicle* pVehicle, const char* vehicleName) {
cout << vehicleName << " s range is: " << pVehicle->calculateRange() << endl;
pVehicle->drive(150);
cout << vehicleName << " s energy left is: " << pVehicle->percentEnergyRemaining() << endl;
cout << vehicleName << " s range is now: " << pVehicle->calculateRange() << endl;
return pVehicle;
}
int main(int argc, char** argv)
{
//50L of gas, 7.1 L/100km
delete testVehicle(new GasolineVehicle(50, 7.1), "Corolla");
//42 L of gas, 4.3 L/100km, 8.8kWh, 22 kWh/100km
delete testVehicle((GasolineVehicle*)new HybridVehicle(42, 4.3, 8.8, 22.0), "Prius");
//75 kWh, 16 kWh/100km
delete testVehicle(new ElectricVehicle(75, 16), "Tesla 3");
return 0;
}

How to use overload operator as condition in a if statment?

Here is the class
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <iomanip>
#include <iostream>
using namespace std;
class Point {
protected:
int x, y;
double operator-(const Point &def){
return sqrt(pow((x-def.x),2.0)+
pow((y-def.y),2.0));
}
};
class Circle: public Point {
private:
int radius;
public:
Circle(){
this->x=x;
this->y=y;
this->radius=radius;
}
Circle(int x, int y, int radius){
this->x=x;
this->y=y;
this->radius=radius;
}
void printCircleInfo() {
cout << x << " " << y << " " << radius << " " ;
}
This is the operator I want to be the condition in my if statement.
bool operator==(const Circle &def){
return (x==def.x) & (y==def.y) & (radius==def.radius);
}
bool doIBumpIntoAnotherCircle(Circle anotherCircle){
if (anotherCircle.radius + radius >= *this - anotherCircle )
return true;
return false;
}
};
Here is main
int main(){
int x,y,radius;
const int SIZE = 13;
Circle myCircleArry[SIZE];
myCircleArry[0] = Circle(5,3,9);
cout << endl;
myCircleArry[0].printCircleInfo(); cout << " ; ";
ifstream Lab6DataFileHandle;
Lab6DataFileHandle.open("Lab6Data.txt");
while (!Lab6DataFileHandle.eof( )) {
for (int i = 1; i < SIZE; i++) {
Lab6DataFileHandle>>x;
Lab6DataFileHandle>>y;
Lab6DataFileHandle>>radius;
myCircleArry[i] = Circle(x,y,radius);
if (myCircleArry[0].doIBumpIntoAnotherCircle(myCircleArry[i])) {
myCircleArry[i].printCircleInfo(); cout << " ; ";
Here is the If statement
if ( operator==( Circle &def))
{cout <<"*";
}
}
}
}
Lab6DataFileHandle.close();
}
How do I use the overloaded operator as the condition of the if statement? If you need any clarification just ask other wise please leave an example in your answer.
Thank you for your time.
A == needs two arguments (even if the overload is a member), you would write the if as any other if statement:
if(circle1 == circle2) { ... }
and if there's a matching overload the compiler would transform that into something like:
if(circle1.operator ==(circle2)) { ... }

Identifier not found - error C3861 in Visual Studio 2019

I have a problem with my code. Unfortunately, when compiling I get these errors all the time. What can this be caused by and how to fix it?
error C3861: 'print': identifier not found
My code:
main.cpp
#include "pojazdy.h"
#include <iostream>
using namespace std;
int main()
{
Pojazdy** poj;
int size{ 0 }, index{ 0 };
Petla(poj, size);
print(poj, size);
wyrejestruj(poj,size,0);
print(poj, size);
wyrejestruj(poj,size);
return 0;
}
pojazdy.h
#ifndef pojazdy_h
#define pojazdy_h
#include <iostream>
#include <cstdlib>
using namespace std;
class Pojazdy
{
public:
string typ;
string marka;
string model;
string z_dod;
int ilosc;
int cena;
void dodaj();
void d_pojazd(Pojazdy**& pojazdy, int& size);
void wyrejestruj(Pojazdy**& pojazdy, int& size, int index);
void print(Pojazdy** pojazdy, int size);
void Petla(Pojazdy**& p, int& size);
//void wyswietl();
int get_ilosc() { return ilosc; }
string get_typ() { return typ; }
string get_marka() { return marka; }
string get_model() { return model; }
int get_cena() { return cena; }
void set_ilosc(int x);
};
#endif
pojazdy.cpp
#include "pojazdy.h"
#include <iostream>
using namespace std;
void Pojazdy::set_ilosc(int x) { ilosc = x; }
void Pojazdy::dodaj()
{
cout << "DODAWANIE POJAZDU..." << endl;
cout << "Podaj typ pojazdu:";
cin >> typ;
cout << "Podaj marke pojazdu: ";
cin >> marka;
cout << "Podaj model pojazdu: ";
cin >> model;
cout << "Dodaj cene pojazdu: ";
cin >> cena;
}
void Petla(Pojazdy**& p, int& size) {
char z_dod;// = 'N';
do {
d_pojazd(p, size); //odpowiada za dodawnie
p[size - 1]->dodaj();
cout << "Czy chcesz zakonczyc dodawanie? Jesli tak, wcisnij Y/N: ";
cin >> z_dod;
} while (z_dod == 'N' || z_dod == 'n');//while (p[size]->z_dod == "N" ||p[size]->z_dod == "n");
}
void print(Pojazdy** pojazdy, int size) {
std::cout << "====================================" << std::endl;
for (int i{ 0 }; i < size; i++)
std::cout << "Typ: " << pojazdy[i]->get_typ() << " Marka: " << pojazdy[i]->get_marka() << " Model: " << pojazdy[i]->get_model() << " Cena: " << pojazdy[i]->get_model() << std::endl;
}
void wyrejestruj(Pojazdy**& pojazdy, int& size) {
for (size_t i{ 0 }; i < size; i++)
delete pojazdy[i];
delete[] pojazdy;
size = 0;
pojazdy = NULL;
}
void wyrejestruj(Pojazdy**& pojazdy, int& size, int index) {
if (index < size) {
Pojazdy** temp = new Pojazdy * [size - 1];
short int j{ -1 };
for (size_t i{ 0 }; i < size; i++) {
if (i != index) {
j++;
temp[j] = pojazdy[i];
}
}
delete[] pojazdy;
--size;
pojazdy = temp;
}
else
std::cout << "Pamiec zwolniona!" << std::endl;
}
void d_pojazd(Pojazdy**& pojazdy, int& size) {
Pojazdy** temp = new Pojazdy * [size + 1];
if (size == 0)
temp[size] = new Pojazdy;
else {
for (int i{ 0 }; i < size; i++)
temp[i] = pojazdy[i];
delete[] pojazdy;
temp[size] = new Pojazdy;
}
++size;
pojazdy = temp;
}
I used #ifndef, #define, #endif and #pragma once, but none of them work. I will be really grateful for every code, I am already tired of this second hour. And forgive the non-English variables and function names for them - it's university code, so I didn't feel the need.
Move the functions below outside the class declaration.
void wyrejestruj(Pojazdy**& pojazdy, int& size, int index);
void print(Pojazdy** pojazdy, int size);
void Petla(Pojazdy**& p, int& size);
Or make them static and call like Pojazdy::print(poj, size);.
You declared a non-static member function print in the class definition
class Pojazdy
{
public:
// ...
void print(Pojazdy** pojazdy, int size);
//...
but you are trying to call it as a stand-alone function in main
print(poj, size);
So the compiler issues an error.
The declaration of the function as a stand alone function that at the same time is its definition in the file pojazdy.cpp is not visible in the module with main because this module includes only the header with the class declaration.
You should decide whether this function should be a member function of the class or a stand alone function.
You are not calling your member functions correctly. print can only be called on an object of type Pojazdy, so you need to do something like:
Pojazdy** poj;
int size{ 0 }, index{ 0 };
Pojazdy x; // Creates an object of Pojazdy called z
x.print(poj,size); // Calls the print method on x
Alternatively, if you don't want to have to declare an object, you could make the method static and just call it on the class.
In the .h file:
static void print(Pojazdy** pojazdy, int size);
And then in main:
Pojazdy** poj;
int size{ 0 }, index{ 0 };
Pojazdy::print(poj, size); // Calls the print method on the class
You put your function prototypes in the wrong place. They should be after the class decalration.
class Pojazdy
{
...
};
void print(Pojazdy** pojazdy, int size);
void wyrejestruj(Pojazdy**& pojazdy, int& size);
etc.
print is not a member of the Pojazdy class, so it's wrong to put the prototype inside the Pojazdy class declaration.

Fuction-definition not allowed RetailItem

I got some problem when run my coding. I got 2 separate file to create RetailItem class and create main. I create both in project.
Below are main.cpp
//main
#include "retailitem.h"
#include <iostream>
#include <iomanip>
using namespace std;
using std::cout;
void displayItem(RetailItem *, const int);
int main()
{
const int Item = 3;
RetailItem ritem[Item] ={ { "Jacket", 12, 59.95 },
{ "Designer Jeans", 40, 34.95 },
{ "Shirt", 20, 24.95 } };
//cout << fixed << setprecision(2);
void displayItem(RetailItem *ritem, const int Item){
cout <<" DESCRIPTION UNITS ON HAND PRICE";
cout<<"=================================================================\n";
for (int i = 0; i < Item; i++)
{
cout << setw(12) << ritem[i].getDesc();
cout << setw(12) << ritem[i].getUnits();
cout << setw(8) << ritem[i].getPrice();
}
cout << "===================================================================";
}
return 0;
}
and there one more file retailitem.h
//RetailItem class
#include <string>
using namespace std;
class RetailItem
{
private:
string description;
int unitsOnHand;
double price;
public:
RetailItem(string,int,double);
void setDesc(string d);
void setUnits(int u);
void setPrice(double p);
string getDesc();
int getUnits();
double getPrice();
};
RetailItem::RetailItem(string desc, int units, double cost)
{
description = desc;
unitsOnHand = units;
price = cost;
}
void RetailItem::setDesc(string d)
{
description = d;
}
void RetailItem::setUnits(int u)
{
unitsOnHand = u;
}
void RetailItem::setPrice(double p)
{
price = p;
}
string RetailItem::getDesc()
{
return description;
}
int RetailItem::getUnits()
{
return unitsOnHand;
}
double RetailItem::getPrice()
{
return price;
}
when compile and run main,
[Error] a function-definition is not allowed here before '{' token
[Error] expected '}' at end of input
I don't know what to fix, how can I solve it?
The error message undoubtedly contained a line number that told you where the problem was. That's an important part of describing the problem. But here it happens to be obvious: void displayItem(RetailItem *ritem, const int Item){ is the start of a function definition. You can't define a function inside another function. Move this outside of main.

Getting the "undefined reference to class::function" error on my C++ game.

I am programming this game for a university work and i believe that my code is right, but i keep getting this error and it is keeping me from finishing my work in time. So here's the game board class header:
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstdio>
class CMagicAlchemistBoard
{
public:
CMagicAlchemistBoard(void); // Default Constructor
CMagicAlchemistBoard(const CMagicAlchemistBoard& board); // Copy Constructor
~CMagicAlchemistBoard(void ); // Destructor
void SetupBoard(void); // Function to setup the board
int GetBoardSpace(int row, int col); // Get the color at row,col
// Accessor functions to get/set board size information
int GetColumns(void) const { return m_nColumns; }
void SetColumns(int nColumns) { m_nColumns = (nColumns >= 6) ? nColumns : 6; }
int GetRows(void) const { return m_nRows; }
void SetRows(int nRows) { m_nRows = (nRows >= 8) ? nRows : 8; }
void DeleteBoard(void); // Function to delete the board and free memory
void ExecuteMove(int row, int col);
bool IsGameOver(void) const; // Is the game over?
void DrawBoard(void);
bool ValidMove(int row, int col); // Function to see if a move is valid
private:
void CreateBoard(void); //Function to create the board and allocate memory
// Class Data
int** m_arrBoard; // 2D array pointer
// Board size information
char m_arrChars[10];
int m_nColumns;
int m_nRows;
};
And here is the .cpp file with only the implementation of the DrawBoard() function:
#include "cmagicalchemistboard.h"
using namespace std;
void CMagicAlchemistBoard::DrawBoard(void)
{
cout << "MAGIC ALCHEMIST" << endl;
cout << " ";
for(int col = 0; col < m_nColumns; col++){ printf(" ---",col); }
cout << endl;
for(int row = 0; row < m_nRows; row++)
{
for(int col = 0; col < m_nColumns; col++)
{
cout << "| " << m_arrChars[GetBoardSpace(row, col)];
}
cout << "| " << endl;
}
}
I pretend to use this function on another class. Here's the header of that class:
#include "cmagicalchemistboard.h"
#include <iostream>
#include <cstdlib>
#include <conio.h> //Contains the function getch(), which reads the input from the keyboard
#define LEFT_ARROW 75
#define RIGHT_ARROW 77
#define UP_ARROW 72
#define DOWN_ARROW 80
#define ESC 27
class CMagicAlchemist
{
public:
CMagicAlchemist();
~CMagicAlchemist();
// Functions for accessing the game board
char GetBoardSpace(int row, int col) { return m_board->GetBoardSpace(row, col); }
void SetupBoard(void) { m_board->SetupBoard(); }
int GetColumns(void) { return m_board->GetColumns(); }
void SetColumns(int nColumns) { m_board->SetColumns(nColumns); }
int GetRows(void) { return m_board->GetRows(); }
void SetRows(int nRows) { m_board->SetRows(nRows); }
void DeleteBoard(void) { m_board->DeleteBoard(); }
bool IsGameOver() { return m_board->IsGameOver(); }
void InputGameParameters();
void GetMove(int &row, int &col);
void DrawBoard();
void NewGame();
void Game();
private:
CMagicAlchemistBoard* m_board; // Instance of the game board
int m_nmoves;
};
And finally, the .cpp file of this last class with only the implementation of the function that calls the DrawBoard() function:
#include "cmagicalchemist.h"
void CMagicAlchemist::Game()
{
int x,y;
InputGameParameters();
NewGame();
DrawBoard();
}
So, my problem is: when i compile this program im getting this error: "undefined reference to CMagicAlchemist::DrawBoard()". This is stupid because the DrawBoard() function doesnt even belong to CMagicAlchemist class but instead, it belong to CMagicAlchemistBoard class. Can somebody help me?
You have DrawBoard declared in your CMagicAlchemist class.
You call DrawBoard from a CMagicAlchemist member function.
That tries to call Drawboard for the CMagicAlchemist class.