Skip to main content
andrewtholt60
Visitor II
November 24, 2016
Question

C++ in a C project

  • November 24, 2016
  • 2 replies
  • 764 views
Posted on November 24, 2016 at 11:58

I am working on a project with the following

NUCLEO-F401RE board

AC6 IDE

A freeRTOS project with, currently, 2 tasks.

I want to add a C++ class, with C wrappers into the project.

I can add the files, with .cpp extensions but the eclipse doesn't compile the files.

I have managed, by a set of fairly elaborate steps to 'hack' something, but I can't believe that there is no simple way to do this.

Any advice appreciated,

    This topic has been closed for replies.

    2 replies

    Jeroen3
    Senior
    December 7, 2016
    Posted on December 07, 2016 at 07:49

    You have two options.

    - Use a C++ compiler.

    - Rename to .c and #if out the C++ lines.

    Liviu Ionescu
    Associate III
    December 7, 2016
    Posted on December 07, 2016 at 09:02

    You can take a look at the demo projects at 

    https://github.com/micro-os-plus/eclipse-demo-projects

     , for example the F4DISCOVERY one.

    All are C++ projects, and all use

    http://micro-os-plus.github.io

    , a system fully written in C++.