c++embeddedc++14msp430

What causes the error #18 expected a ")" on a MSP430


Compiling the following C++14 code for a MSP430 using TI Code Composer I got the following errors:

subdir_rules.mk:14: recipe for target 'main.obj' failed
"Interface.h", line 75: error #18: expected a ")"
"Derived.h", line 91: error #18: expected a ")"

This is for the following code structure in which the Interface.h class is a library which compiles fine for STM32 targets.

#include <cstdint>

namespace NS
{
  class Interface 
  {
    public:
      // Other pure virtual functions such as:
      virtual void advance() = 0;

      // This is the problem function
      virtual void advance(const uint32_t N) = 0;
  };
}

Next in the MSP430 project the interface is used in multiple objects. This is one example of multiple implementations, they all give the same error.

#include "Interface.h"

class Derived : public ::NS::Interface
{
  public:
    // Overriding virtual functions with implementations in cpp file.
    void advance() override;

    // The problematic function
    void advance(const uint32_t N) override;

  private:
    uint32_t index;
};

The cpp file:

#include "Derived.h"

Derived::advance() 
{
  ++index;
}

Derived::advance(const uint32_t N)
{
  index += N;
}

Now inspecting the code for any "funny" characters like Greek question marks did not yield any result. I tried replacing the text, typing it again etc to no result

Commenting out the functions advance(const uint32_t N) resolves the problem so it is not something else in the file.

What could cause this problem?


Solution

  • The problem was indeed as @Clifford mentioned. N was already defined somewhere in the MSP430 code. Renaming Derived::advance(const uint32_t N) to Derived::advance(const uint32_t N_bytes) solves the problem.