Coding in C++ in Creator 2.2

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I am relatively new to Psoc5 and Creator and am re-acquainting myself with C++.  I am having difficulties getting a particular program to build.  I know that Creator is C based but that one can also "force" it to recognize and compile C++ code.  The program is extremely simple:

   

#include <iostream>
using namespace std;

int GetFibNumber(int FibIndex)
{
    if (FibIndex < 2)
        return FibIndex;
    else
        return GetFibNumber(FibIndex - 1) + GetFibNumber(FibIndex - 2);
}

int main()
{
    cout << "Enter 0-based index of desired Fibonacci Number: ";
    int Index = 0;
    cin >> Index;
   
    cout << "Fibonacci number is: " << GetFibNumber(Index) << endl;
    return 0;
}

   

In the Build Settings associated with all .c files I have added "-x c++" as a custom flag in the command line.  The errors I get when I build this is:

   

prj.M0120: undefined symbol `Reset' referenced in expression

   

prj.M0120: The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.

   

Any ideas what I'm missing?  Thanks.

0 Likes
12 Replies