compling error in winAVR

caizifang wrote on Monday, May 05, 2008:

I want to use the mutexes,and
#define configUSE_MUTEXES   1    //in FreeRTOSConfig.h
#include "semphr.h"              //in FreeRTOSConfig.h
xSemaphoreHandle xSemaphore = NULL ;   //in main.c

…/queue.h:119: error: expected ‘;’, ‘,’ or ‘)’ before ‘uxQueueLength’
…/queue.h:455: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueGenericSend’
…/queue.h:735: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueGenericReceive’
…/queue.h:750: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uxQueueMessagesWaiting’
…/queue.h:1057: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueGenericSendFromISR’
…/queue.h:1146: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueReceiveFromISR’
…/queue.h:1152: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueIsQueueEmptyFromISR’
…/queue.h:1153: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueIsQueueFullFromISR’
…/queue.h:1154: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uxQueueMessagesWaitingFromISR’
…/queue.h:1171: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueAltGenericSend’
…/queue.h:1172: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueAltGenericReceive’
…/queue.h:1187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueCRSendFromISR’
…/queue.h:1188: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueCRReceiveFromISR’
…/queue.h:1189: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueCRSend’
…/queue.h:1190: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueCRReceive’
…/queue.h:1197: error: expected ‘;’, ‘,’ or ‘)’ before ‘uxCountValue’
…/queue.h:1203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueTakeMutexRecursive’
…/queue.h:1204: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xQueueGiveMutexRecursive’
make: *** [croutine.o] Error 1

I donot change the queue.h file,why does it have error?
I use the FreeRTOS V5.0.0.

woops_ wrote on Monday, May 05, 2008:

Probably you are including header files in bad order. Do not include semphr from freertosconfig.h but from the C file that uses semaphore. semphr.h must come after FreeRTOS.h. See the demo files that include semphr.h for an example of including in the right place.

caizifang wrote on Monday, May 05, 2008:

woops,Thank you very much . I move #include “semphr.h" to main.c file,and locate it after #include "FreeRTOS.h",then it is ok.
When I locate it before #include "FreeRTOS.h", the same error will occur.Really incredible!I didnot think of it before.