Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists