This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Combining C and C++ libraries

Former Member
Former Member

I'm a novice with STM32 and Keil.  I'd like to use a BMP280 C library and a RFM69 C++ library.  I wasn't able to understand how to use both in the same project.  Can someone share some advice/guidance?  The C++ library uses .hpp files and they were not recognized.  I was probably making a mistake.  Thank you in advance for any help.

Frank

Parents Reply Children
  • manually writing the prototype multiple times with different formats in different files is a maintenance nightmare!

    That example misses the usual practice of using a #ifdef __cplusplus so that the same header can be used by both .c and .cpp files:

    #ifdef __cplusplus
    extern "C" {
    #endif
    
    void myFunc(int);
    
    #ifdef __cplusplus
    }
    #endif