Undefined reference Error C++
Posted: Thu Apr 21, 2022 9:24 am
Hello, C++ is getting an undefined frequency error. I am attaching the C++ Source Codes and the Screenshot of the Error.
port.cpp soucres code:
port.h soucres code:
Github Repos: https://github.com/mehmetprogramci/Kapilar_OS
port.cpp soucres code:
Code: Select all
#include "port.h"
Port::~Port()
{
}
Port8Bit::Port8Bit(uint16_t portnumber)
: Port(portnumber)
{
}
Port8Bit::~Port8Bit()
{
}
void Port8Bit::Write(uint8_t data)
{
__asm__ volatile("outb %0, %1" : : "a" (data), "Nd" (portnumber));
}
uint8_t Port8Bit::Read()
{
uint8_t result;
__asm__ volatile("inb %1, %0" : "=a" (result) : "Nd" (portnumber));
return result;
}
Port8BitSlow::Port8BitSlow(uint16_t portnumber)
: Port8Bit(portnumber)
{
}
Port8BitSlow::~Port8BitSlow()
{
}
void Port8BitSlow::Write(uint8_t data)
{
__asm__ volatile("outb %0, %1\njmp 1f\n1: jmp 1f\n1:" : : "a" (data), "Nd" (portnumber));
}
Port16Bit::Port16Bit(uint16_t portnumber)
: Port(portnumber)
{
}
Port16Bit::~Port16Bit()
{
}
void Port16Bit::Write(uint16_t data)
{
__asm__ volatile("outw %0, %1" : : "a" (data), "Nd" (portnumber));
}
uint16_t Port16Bit::Read()
{
uint16_t result;
__asm__ volatile("inw %1, %0" : "=a" (result) : "Nd" (portnumber));
return result;
}
Port32Bit::Port32Bit(uint16_t portnumber)
: Port(portnumber)
{
}
Port32Bit::~Port32Bit()
{
}
void Port32Bit::Write(uint32_t data)
{
__asm__ volatile("outl %0, %1" : : "a" (data), "Nd" (portnumber));
}
uint32_t Port32Bit::Read()
{
uint16_t result;
__asm__ volatile("inl %1, %0" : "=a" (result) : "Nd" (portnumber));
return result;
}
port.h soucres code:
Code: Select all
#ifndef __PORT_H
#define __PORT_H
#include "types.h"
class Port
{
protected:
uint16_t portnumber;
Port(uint16_t portnumber);
~Port();
};
class Port8Bit : public Port
{
public:
Port8Bit(uint16_t portnumber);
~Port8Bit();
virtual void Write(uint8_t data);
virtual uint8_t Read();
};
class Port8BitSlow : public Port8Bit
{
public:
Port8BitSlow(uint16_t portnumber);
~Port8BitSlow();
virtual void Write(uint8_t data);
};
class Port16Bit : public Port
{
public:
Port16Bit(uint16_t portnumber);
~Port16Bit();
virtual void Write(uint16_t data);
virtual uint16_t Read();
};
class Port32Bit : public Port
{
public:
Port32Bit(uint16_t portnumber);
~Port32Bit();
virtual void Write(uint32_t data);
virtual uint32_t Read();
};
#endif
Github Repos: https://github.com/mehmetprogramci/Kapilar_OS