Quality RTOS & Embedded Software

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


Loading

Compiliation Error

Posted by Scott Nortman on January 4, 2007
Hi,

When coding a C project, I typically have one include file, "Include.h" where I place all of my other include files. I then put a #include "Include.h" in each *.h and *.c file of my project.

I always use the

#ifndef _FILE_H
#define _FILE_H

< stuff here >

#endif

syntax to prevent multiple inclusions of the same file.

I am having the following problems:

1) When I place the following in my "Include.h" file:

/* FreeRTOS Schedular Files, in Include.h */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"

and then place this in main.c:

#include "Include.h"

my code compiles fine but FreeRTOS doesn't work. I can't get any tasks to execute. But when I directly put this in main:

/* FreeRTOS Schedular Files, in main.c */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"

FreeeRTOS works as expected.

Any thoughts as to why this may be occurring?

2) After adding more files to my project, I attempted to compile and I got this error:

Compiling: FreeRTOSV4.1.3/FreeRTOS/Source/queue.c
avr-gcc -c -mmcu=atmega64 -I. -D GCC_MEGA_AVR -I. -g -Os -fsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wextra -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wunused -Wa,-adhlns=FreeRTOSV4.1.3/FreeRTOS/Source/queue.lst -I./Includes -I./FreeRTOSV4.1.3/FreeRTOS/Source/include -I./FreeRTOSV4.1.3/FreeRTOS/Source/portable/GCC/ATMega64 -std=gnu99 FreeRTOSV4.1.3/FreeRTOS/Source/queue.c -o FreeRTOSV4.1.3/FreeRTOS/Source/queue.o
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:112: error: conflicting types for 'xQueueHandle'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:36: error: previous declaration of 'xQueueHandle' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:119: error: conflicting types for 'xQueueCreate'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:94: error: previous declaration of 'xQueueCreate' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:119: error: conflicting types for 'xQueueCreate'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:94: error: previous declaration of 'xQueueCreate' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:120: error: conflicting types for 'xQueueSend'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:173: error: previous declaration of 'xQueueSend' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:120: error: conflicting types for 'xQueueSend'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:173: error: previous declaration of 'xQueueSend' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:121: error: conflicting types for 'uxQueueMessagesWaiting'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:275: error: previous declaration of 'uxQueueMessagesWaiting' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:121: error: conflicting types for 'uxQueueMessagesWaiting'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:275: error: previous declaration of 'uxQueueMessagesWaiting' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:122: error: conflicting types for 'vQueueDelete'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:289: error: previous declaration of 'vQueueDelete' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:122: error: conflicting types for 'vQueueDelete'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:289: error: previous declaration of 'vQueueDelete' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:123: error: conflicting types for 'xQueueSendFromISR'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:364: error: previous declaration of 'xQueueSendFromISR' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:123: error: conflicting types for 'xQueueSendFromISR'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:364: error: previous declaration of 'xQueueSendFromISR' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:124: error: conflicting types for 'xQueueReceive'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:260: error: previous declaration of 'xQueueReceive' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:124: error: conflicting types for 'xQueueReceive'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:260: error: previous declaration of 'xQueueReceive' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:125: error: conflicting types for 'xQueueReceiveFromISR'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:453: error: previous declaration of 'xQueueReceiveFromISR' was here
FreeRTOSV4.1.3/FreeRTOS/Source/queue.c:125: error: conflicting types for 'xQueueReceiveFromISR'
./FreeRTOSV4.1.3/FreeRTOS/Source/include/queue.h:453: error: previous declaration of 'xQueueReceiveFromISR' was here
make.exe: *** [FreeRTOSV4.1.3/FreeRTOS/Source/queue.o] Error 1


Any thoughts?

Thanks,
Scott Nortman

RE: Compiliation Error

Posted by embeddedc on January 4, 2007
You cannot include queue.h in queue.c. This is because the queue handle is defined as a pointer to a structure in queue.c and a pointer to a void in queue.h. Hides the implementation of the queue structures from application programs.

RE: Compiliation Error

Posted by Scott Nortman on January 4, 2007
I am not including queue.h in queue.c, the FreeRTOS portion of the code is unmodified and I just verified that queue.h is not included in queue.c

--Scott

RE: Compiliation Error

Posted by embeddedc on January 4, 2007
Agreed - rereading your original post it would seem that you are not including queue.h in queue.c if you only modified your code not the freertos code. But this is what the error is showing has happened. There is a conflicting type between the queue.h and queue.c. Could it be that there is already an Include.h file somewhere in the compiler libraries, and when compiling queue.c it is including your include.h in place of the library include.h. Try changing the name of your file to include2.h or something else.

RE: Compiliation Error

Posted by Scott Nortman on January 4, 2007
I've followed the header file method from the examples files and removed my "Include.h" file and I was able to get around the issue.

Thanks for your help.

--scott


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


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

Latest News

Version 10.1.0 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