Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

error: array type has incomplete element type

Posted by skidev on July 29, 2011
I'm trying to build the uIP/webserver demo for the LPCXpresso1768/9; I've built a Code Red FreeRTOS skeleton project and then included the webserver src directory from the FreeRTOSv7.01 Demo tree.

In httpd-fsdata.c, the structure

static const char data_404_html[] = {
/* /404.html */
0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c,
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22,
0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e,
0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d,
0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20,
0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e,
0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33,
0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65,
0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65,
0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65,
0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20,
0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65,
0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64,
0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e,
0};

referenced by

const struct httpd_fsdata_file file_404_html[] = {{NULL, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10, 0}};

gives me the error

../src/httpd-fsdata.c:544:32: error: array type has incomplete element type

which utterly baffles me. A number of people seem to be experiencing similar errors with gcc 4.x based tools, but I find nothing that may help with this particular issue.

LPCXpresso LPC1769, LPCXpresso 4 tools, FreeRTOS v7.01.

Ideas?

Thanks,

Mike


RE: error: array type has incomplete element type

Posted by skidev on July 29, 2011
...and when I include httpd-fsdata.h, I lose the

/src/httpd-fsdata.o:(.rodata.file_404_html+0x0): multiple definition of `file_404_html'

but now I get

./src/httpd-fsdata.o:(.rodata.file_404_html+0x0): multiple definition of `file_404_html'
./src/httpd-fs.o:(.rodata.file_404_html+0x0): first defined here

the declaration of httpd_fsdata_file in httpd_fsdata.h

struct httpd_fsdata_file {
const struct httpd_fsdata_file *next;
const char *name;
const char *data;
const int len;
#ifdef HTTPD_FS_STATISTICS
#if HTTPD_FS_STATISTICS == 1
u16_t count;
#endif /* HTTPD_FS_STATISTICS */
#endif /* HTTPD_FS_STATISTICS */
};

so it seems that the pointer in the first parameter is somehow being seen as a redeclaration?

My head hurts.

Any thoughts?

Thanks,

Mike

RE: error: array type has incomplete element type

Posted by Richard on July 29, 2011
“../src/httpd-fsdata.c:544:32: error: array type has incomplete element type”


The clue is in the error message. If you dig deep enough into the structures you will find that the line:

const struct httpd_fsdata_file file_404_html[] = {{NULL, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10, 0}};

only provides initialisers for the first n of the elements in the httpd_fsdata_file structure. That is perfectly legal, and should generate a warning, not an error, unless you have turned on the "treat warnings as errors" compiler option. I can't remember exactly what to do to remove the warning, but I *think*, from memory, that just adding a 0 to the end of the init list will fix it. Please check though, this is just from memory.


“/src/httpd-fsdata.o:(.rodata.file_404_html+0x0): multiple definition of `file_404_html'”


Don't include httpd-fsdata.c in your build. It is #included from another file already (probably fsdata.c) - hence building it explicitly means it is built twice, and all the structs it contains will therefore be defined twice.

Treat the file as if it was a .h file, not a .c file. I have no idea why it was given a .c extension when it is just #included as you would normally a .h.

Regards.

RE: error: array type has incomplete element type

Posted by skidev on July 29, 2011
The clue is in the error message. If you dig deep enough into the structures you will find that the line:

const struct httpd_fsdata_file file_404_html[] = {{NULL, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10, 0}};

only provides initialisers for the first n of the elements in the httpd_fsdata_file structure. That is perfectly legal, and should generate a warning, not an error, unless you have turned on the "treat warnings as errors" compiler option. I can't remember exactly what to do to remove the warning, but I *think*, from memory, that just adding a 0 to the end of the init list will fix it. Please check though, this is just from memory.


No, that didn't help, and warnings are not treated as errors either.

Don't include httpd-fsdata.c in your build. It is #included from another file already (probably fsdata.c) - hence building it explicitly means it is built twice, and all the structs it contains will therefore be defined twice.

Treat the file as if it was a .h file, not a .c file. I have no idea why it was given a .c extension when it is just #included as you would normally a .h.


I did include the .h file; not the .c - it's compiling the .c file that's blowing up with the new gcc in LPCXpresso 4.

and treating warnings as errors is definitely *not* set.

Ideas?



RE: error: array type has incomplete element type

Posted by skidev on July 29, 2011
I meant to add that httpd-fsdata.c is part of the build - it initializes all the page content.

Was the Code Red demo app tested with LPCXpresso 3.x or 4?

RE: error: array type has incomplete element type

Posted by Richard on July 29, 2011
“it's compiling the .c file that's blowing up”


Yes, exactly. Do not compiler the C file - exclude it from the build. Eclipse will just blindly build anything under the project directory unless you explicitly tell it not to. That C file is already #included in another file and must not be built separately.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner