error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before function_name

StackOverflow https://stackoverflow.com/questions/18560744

  •  27-06-2022
  •  | 
  •  

Domanda

Here is the error:

msp430-gcc -mmcu=msp430g2553 -Os   -c -o gpio_test.o gpio_test.c
In file included from msp430_lib.h:9:0,
                 from gpio_test.c:4:
gpio_api.h:20:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gpio_init’
gpio_api.h:27:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gpio_ioctl_pull_en’
gpio_api.h:35:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gpio_write’
make: *** [gpio_test.o] Error 1

Here is the header file where the error is coming from(The line numbers don't match up because I stripped all the comments out of the file to shorten it):

/* gpio_api.h - General Purpose Input/Output API
*/

#ifndef MSP_GPIO_API_H
#define MSP_GPIO_API_H

#include  <msp430g2553.h>

#define INPUT   0
#define OUTPUT  1
#define DOWN    0
#define UP      1

bool gpio_init(int port, int pin, int direction);

bool gpio_ioctl_pull_en(int port, int pin, int direction);

bool gpio_write(int port, int pin, int value);

int  gpio_read (int port, int pin);

#endif

It seems simple enough, yet I can't figure out what my problem is.

È stato utile?

Soluzione

You have to include <stdbool.h> in your program. bool is actually a macro defined in stdbool.h header file.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top