Skip to content

Commit 68b1890

Browse files
Benoit Leforestiernashif
authored andcommitted
C++ : Fix error: template with C linkage
If we include this headers files in cpp source code, the compiler say"error: template with C linkage". Includes must be moved outside the 'extern "C"' section. Signed-off-by: Benoit Leforestier <[email protected]>
1 parent 61cb8b6 commit 68b1890

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

include/can.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
* @{
2121
*/
2222

23-
#ifdef __cplusplus
24-
extern "C" {
25-
#endif
26-
2723
#include <zephyr/types.h>
2824
#include <device.h>
2925
#include <string.h>
3026

27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
3131
#define CAN_EX_ID (1 << 31)
3232
#define CAN_MAX_STD_ID (0x7FF)
3333
#define CAN_STD_ID_MASK CAN_MAX_STD_ID

include/i2c.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
* @{
2020
*/
2121

22+
#include <zephyr/types.h>
23+
#include <device.h>
24+
2225
#ifdef __cplusplus
2326
extern "C" {
2427
#endif
2528

26-
#include <zephyr/types.h>
27-
#include <device.h>
28-
2929
/*
3030
* The following #defines are used to configure the I2C controller.
3131
*/

include/sensor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
* @{
2020
*/
2121

22-
#ifdef __cplusplus
23-
extern "C" {
24-
#endif
25-
2622
#include <zephyr/types.h>
2723
#include <device.h>
2824
#include <errno.h>
2925

26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
3030
/**
3131
* @brief Representation of a sensor readout value.
3232
*

0 commit comments

Comments
 (0)