peter zhang
peter zhang

Reputation: 1

change c to cpp file in ccs v6

While using ccs v6, I tried to change the c file to cpp file. The original c file contains several header files.

#include "stdio.h"
#include "types.h"
#include "evmomapl138.h"
#include "evmomapl138_timer.h"
#include "evmomapl138_i2c.h"
#include "test_led_dip.h"

But after changing it into cpp file, it returns an error of expected an identifier in types.h

#ifndef TYPES_H
#define TYPES_H

typedef unsigned char   uint8_t;
typedef unsigned short  uint16_t;
typedef unsigned int    uint32_t;
typedef unsigned long   ulong_t;
typedef signed char     int8_t;
typedef signed short    int16_t;
typedef signed int      int32_t;
typedef signed long     long_t;

typedef enum 
{
    false = 0,
    true = 1
}bool_e;

#endif

The compiler said false =0 and true = 1 sentences expected an identifier. But I have modified the header file inclusion to become

extern "C"
{
    #include "types.h"
}

Thank you for your answer!

Upvotes: 0

Views: 468

Answers (1)

zam664
zam664

Reputation: 767

In cpp true and false are keywords.

Upvotes: 1

Related Questions