input stderr Compilation failed due to following error(s). main.cpp:(.text+0x39): undefined reference to `Actor::Actor()

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

input stderr Compilation failed due to following error(s). main.cpp:(.text+0x39): undefined reference to `Actor::Actor()

Post by answerhappygod »

Input Stderr Compilation Failed Due To Following Error S Main Cpp Text 0x39 Undefined Reference To Actor Actor 1
Input Stderr Compilation Failed Due To Following Error S Main Cpp Text 0x39 Undefined Reference To Actor Actor 1 (106.48 KiB) Viewed 142 times
Urgent Need C++ Help with code throwing errors.
I have finished the code but I am getting these errors, Please
help!
(The code below)
///////////////////////////////////////////////////Main.cpp
#include
#include"Actor.h"
#include"StackLinked.h"
using namespace std;
int main(void) {
StackLinked SL1;
Actor First, Any;
Actor Second("Chadwick Boseman", 44, 'M',false);
Actor Third("Letitia Wright", 28, 'F',true);
SL1.Push(First);
SL1.Push(Third);
SL1.Push(Second);
Any = SL1.Top();
Any.printActor();
SL1.Pop(Any);
system("pause");
return 0;
}
//////////////////////////////////////////////////////Actor.h
//Project on Actors Awards
#pragma once
#include
using namespace std;
class Actor
{
private:
string AName;
int AAge;
char Agender;
bool Award;
public:
Actor();
Actor(std::string, int, char, bool);
void setAName(string);
void setAAge(int);
void setAgender(char);
void setAward(bool);
string getAName();
int getAAge();
char getAgender();
bool getAward();
int Compare(Actor A);
void printActor();
};
//////////////////////////////////////////////////////StackLinked.h
#pragma once
#include "Actor.h"
struct NodeType {
Actor info;
NodeType* next;
};
class StackLinked
{
public:
StackLinked();
void Push(Actor item);
bool IsFull() const;
Actor Top();
void Pop(Actor& item);
~StackLinked();
private:
NodeType * top;
int length;
};
//////////////////////////////////////////////////////////StackLinked.cpp
#include
#include
#include "StackLinked.h"
#include "Actor.h"
using namespace std;
StackLinked::StackLinked()
{
length = 0;
top = nullptr;
}
void StackLinked::Push(Actor item)
{
NodeType* location;
location = new NodeType;
location->info = item;
if (top == nullptr)
{
top = location;
}
else
{
location->next = top;
top = location;
}
length++;
}
bool StackLinked::IsFull() const
{
return false;
}
Actor StackLinked::Top()
{
if (top == nullptr)
throw "Empty stack!";
return top->info;
}
void StackLinked::Pop(Actor & item)
{
if (top == nullptr)
throw "Empty stack!";
NodeType *temp = top;
item = temp->info;
top = top->next;
length--;
delete temp;
}
StackLinked::~StackLinked()
{
NodeType *temp = top;
while (temp != nullptr)
{
top = top->next;
delete temp;
temp = top;
}
}
input stderr Compilation failed due to following error(s). main.cpp:(.text+0x39): undefined reference to `Actor::Actor()' /usr/bin/ld: main.cpp:(. text+0x48): undefined reference to `Actor::Actor()' /usr/bin/ld: main.cpp:(.text+0x94): undefined reference to `Actor::Actor(std:: _cxx11:: basic_string, std::allocator >, int, char, bool)' /usr/bin/ld: main.cpp:(.text+0xf8): undefined reference to `Actor::Actor(std:: _cxx11::basic_string, std::allocator >, int, char, bool)' /usr/bin/ld: main.cpp:(.text+0x1ff): undefined reference to `Actor::printActor()' /usr/bin/ld: /tmp/cC6IMGRC.o: in function Node Type: :NodeType()': StackLinked.cpp:(.text. _ZN8NodeTypeC2Ev[_ZN8NodeTypeC5Ev] +0x18): undefined reference to `Actor::Actor()' collect2: error: ld returned 1 exit status
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply