How To Use C++ With PSoC Creator
Ever wanted to write C++ for the PSoC 5 or 5LP chips in PSoC Creator?
Well, although PSoC Creator doesn’t natively support it, you can quite easily do a few ‘hacks’, and you’ll be writing in C++ in no time.
A new page Using C++ With PSoC Creator, explains the steps required to compile C++ code in Cypress’s PSoC Creator.
It covers the four main steps:
- Compiling with G++ rather than GCC using custom compiler flags
-
Wrapping C code with guards:
extern C{< C code goes here>} -
Defining the operators new and delete (this is optional)
void* operator new(size_t size) -
Prevent Exception Functionality
Preventing exception functionality to prevent linker errors such as
undefined reference to __gxx_personality_v0
andundefined reference to __cxa_end_cleanup
(again, this is optional, and only applied if you want to use new and delete)
![](/_astro/cplusplus-linker-error-undefined-reference-to-gxx-personality.C7_JCJP9_ZPQf3e.webp)
The steps have pictures and code examples to help you through the process.
Checkout the page here.