Skip to content

Build now failing when using template class. #206

Closed
@Chris--A

Description

@Chris--A

Using IDE 1.8.2

After doing up some code for a forum user, I did a test compile. When I came back to my PC, flames were shooting out the CD drive, and the bit bucket under my desk was overflowing with nibbles of 1's.

To solve the issue, I now have to manually add setup and loop prototypes.

void setup();
void loop();

template< uint16_t nBuffSize >
  class Foo{
    public: 
  
    template< uint16_t N >
      Foo &operator +=( const Foo<N> &ref ){
        //...
        return *this;
    }
};

Foo<64> a;
Foo<32> b;

void setup(){
  a += b;
}

void loop(){}

The preprocessor adds the setup and loop prototypes in between:
template< uint16_t N > and
Foo &operator +=( const Foo<N> &ref ){
...in the middle of the class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions