Well, I can't tell you exactly what's causing the error, but your linker is telling you what's missing. So we don't need to tell you that. But your code is confusing and (for me) hard to follow. First, you don't need to redefine portnumber in every descendant class. Since port is the progenitor of all the different port class types, referring to it will automatically refer to the class member variable in the base class. Second, you don't need all those descendant classes. It would simplify your code dramatically if you used a template class and then just instantiated that for each port type (u8, u16, u32), or used function overloads within the port class itself. And you also don't need a destructor -- there's nothing to "destroy" so you can let the compiler handle that for you automatically via the default destructor. Finally, your implementation of port*slow::write is broken: you have two labels, 1, and I'm pretty sure that's not going to assemble because I'm pretty sure you can't define two labels with the same name. But maybe this is a querk of the GNU As assembler that I just don't know about and this is perfectly okay.
Would you mind giving us a GitHub repository link and posting the error instead of a screenshot?
Edit: actually, there aren't any screenshots attached anyway, so nobody is going to know what your linker is complaining about other than you.
iansjack wrote:Numeric labels have a special usage in as. They have local scope and can be redefined.
Oh okay, I thought that would be an assemble-time error. Though at my first quick glance I thought it would be an infinite loop so I had to re-read it and then I revised that assessment.
The “f” or “b” after the number in the jump instruction refer to the first label with that number searching forwards or backwards from the current IP. It can be quite useful, particularly in macros.
Ethin wrote:First, you don't need to redefine portnumber in every descendant class.
I'm looking at the code, and it doesn't do that. Only the Port class defines the portnumber field, in the subclasses portnumber only appears as a constructor parameter.
Ethin wrote:First, you don't need to redefine portnumber in every descendant class.
I'm looking at the code, and it doesn't do that. Only the Port class defines the portnumber field, in the subclasses portnumber only appears as a constructor parameter.
Oh I thought I saw that... My bad. And my re-reads still yielded that... Huh.
You are declaring that Port has a constructor. It is implicitly used by all subclasses. Therefore, you must define a constructor for class Port. And if it is empty.
Ethin wrote:Well, I can't tell you exactly what's causing the error, but your linker is telling you what's missing. So we don't need to tell you that. But your code is confusing and (for me) hard to follow. First, you don't need to redefine portnumber in every descendant class. Since port is the progenitor of all the different port class types, referring to it will automatically refer to the class member variable in the base class. Second, you don't need all those descendant classes. It would simplify your code dramatically if you used a template class and then just instantiated that for each port type (u8, u16, u32), or used function overloads within the port class itself. And you also don't need a destructor -- there's nothing to "destroy" so you can let the compiler handle that for you automatically via the default destructor. Finally, your implementation of port*slow::write is broken: you have two labels, 1, and I'm pretty sure that's not going to assemble because I'm pretty sure you can't define two labels with the same name. But maybe this is a querk of the GNU As assembler that I just don't know about and this is perfectly okay.
Would you mind giving us a GitHub repository link and posting the error instead of a screenshot?
Edit: actually, there aren't any screenshots attached anyway, so nobody is going to know what your linker is complaining about other than you.
Hello, The codes for the error are in the Port.cpp and port.h files. I've Created the Github Repository And Uploaded the Image Related to the Error What is the Error Exactly?
Ethin wrote:Well, I can't tell you exactly what's causing the error, but your linker is telling you what's missing. So we don't need to tell you that. But your code is confusing and (for me) hard to follow. First, you don't need to redefine portnumber in every descendant class. Since port is the progenitor of all the different port class types, referring to it will automatically refer to the class member variable in the base class. Second, you don't need all those descendant classes. It would simplify your code dramatically if you used a template class and then just instantiated that for each port type (u8, u16, u32), or used function overloads within the port class itself. And you also don't need a destructor -- there's nothing to "destroy" so you can let the compiler handle that for you automatically via the default destructor. Finally, your implementation of port*slow::write is broken: you have two labels, 1, and I'm pretty sure that's not going to assemble because I'm pretty sure you can't define two labels with the same name. But maybe this is a querk of the GNU As assembler that I just don't know about and this is perfectly okay.
Would you mind giving us a GitHub repository link and posting the error instead of a screenshot?
Edit: actually, there aren't any screenshots attached anyway, so nobody is going to know what your linker is complaining about other than you.
Hello, The codes for the error are in the Port.cpp and port.h files. I've Created the Github Repository And Uploaded the Image Related to the Error What is the Error Exactly?