Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Coding in C++ in Creator 2.2

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Coding in C++ in Creator 2.2
Moderator:
JFMD

Post Reply
Follow this topic



Coding in C++ in Creator 2.2

gube posted on 10 May 2013 1:56 PM PST
Member
8 Forum Posts

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.




Re: Coding in C++ in Creator 2.2

gube posted on 10 May 2013 07:07 PM PST
Member
8 Forum Posts

So I've been digging and reading forum posts...

One setting that I had wrong was with the toolchain.  I was not using the ARM GCC Generic toolchain but I fixed that.  Then I discovered that the path was incorrect...I fixed that.

Now I'm getting the following:

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

Still hoping for some helpful insights



Re: Coding in C++ in Creator 2.2

PSoC73 posted on 10 May 2013 08:15 PM PST
Top Contributor
176 Forum Posts
This might help. http://cladlab.com/programming/microcontrollers/psoc/using-cplusplus-with-psoc-creator

Re: Coding in C++ in Creator 2.2

H L posted on 11 May 2013 10:04 PM PST
Top Contributor
679 Forum Posts

 Good reading



Re: Coding in C++ in Creator 2.2

gube posted on 11 May 2013 08:13 AM PST
Member
8 Forum Posts

Yeah, I read that article earlier and it helped me eliminate a ton of build errors but alas two remain:

undefined symbol `Reset' referenced in expression

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

I tried specifying the generic toolchain ARM Generic and also ARM GCC 4.4.1 with identical results.

I'm about to abandon efforts to force C++ in Creator and conform to C, although I still believe C++ is a better overall tool.  The upside is that eventually I'll know both!



Re: Coding in C++ in Creator 2.2

PSoC73 posted on 11 May 2013 09:22 AM PST
Top Contributor
176 Forum Posts
OK, I would tell you a uncertain method that success at AVR Studio but no good for PSoC1 Designer, The Method is Delete "gcc.exe" and rename "g++.exe" to "gcc.exe" I have not do on Creator yet. This is unsure way. I don't know what will happen. Anyway, I know clearly, C++ for PSoC has dificult problem. PSoC's peripheral module was build by conventional C, you know. When you want to programming by c++, you have to make wrapping class for those all user modules. PSoC is the most objective MCU ever, I agree that need objective language for PSoC. We have to wait when the Cypress decide ganna change and make C++ for PSoC. How do you think?

Re: Coding in C++ in Creator 2.2

PSoC73 posted on 11 May 2013 09:46 AM PST
Top Contributor
176 Forum Posts
Recently, I think The PSoC has the objective method already itself. A kinda capsulation and a kinda Inheritance was practically established already. Do you know custom user module? That is practically objective method. You could be know when use this.




ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20