6 years, 8 months ago.

Compile Error in PortOut.h: Field _port has incomplete type port_t (aka port_s)

Good day,

I am starting out on a new project and have hit a wall trying to use PortOut. The code I'm trying to compile is as follows:

main.cpp

#include "mbed.h"

#define RGB_MASK 0x0200000A
#define RED_LED 0x02000000
#define GREEN_LED 0x00000008
#define BLUE_LED 0x00000002

PortOut rgb_led(Port0, RGB_MASK);

int main() {
	while(true){
		wait(1);
		rgb_led = RGB_MASK;
		wait(1);
		rgb_led = RED_LED;
		wait(1);
		rgb_led = GREEN_LED;
		wait(1);
		rgb_led = BLUE_LED;
		wait(1);
	}
}

When compiling, the following note and error appear:

Quote:

...\mbed\hal\port_api.h:32:16: note: forward declaration of 'port_t {aka struct port_s}'

and

Quote:

...\mbed\drivers/PortOut.h:109:12: error: field '_port' has incomplete type 'port_t {aka port_s}'

This is mbed code right out of the box. Am I doing something wrong?

Greetings, Andy

Hi there, which target/board are you using with this code?

- Jenny, team Mbed

posted by Jenny Plunkett 18 Apr 2018

I am using the LPCXpresso1549 board.

posted by Andrew Delay 19 Apr 2018
Be the first to answer this question.