arduino-serial icon indicating copy to clipboard operation
arduino-serial copied to clipboard

Compilation on c++

Open FrederikVagner opened this issue 12 years ago • 1 comments

Sorry to border you here, while you lib works amazingly well, it has a small compilation problem if you compile on a c++ code/compiler. May a suggest to warp the function signatures around a:

ifdef __cplusplus

extern "C" {

endif

. . .

ifdef __cplusplus

}

endif

Except for that, your library is perfect and really solved my serial communication problems with Arduino, so thank you for that.

PS: without the extern "C", the code will not compile/link, but the proposed solution removes all the problems

FrederikVagner avatar Nov 11 '13 20:11 FrederikVagner

I don't think it is necessary. Just include the headers in your main.hpp like that:

extern "C" {
    #include "arduino-serial-lib.h"
}

adamryczkowski avatar Feb 25 '16 18:02 adamryczkowski