Type undefined reference to `vTaskDelete'

mahendra12345 wrote on Thursday, September 15, 2016:

Hello there,
I’m using WIN32 simmulator with mingw to learn FreeRTOS.
Everything is working greate and I’ve create project asscodiated with task, queue, semaphore, mutex etc
Now the problem is when i wanted to delete perticular task then my compiler shows me message "Type undefined reference to `vTaskDelete’"

I’ve included all necessary header files but i really don’t know whats wrong with it. More ever with eclipse when i click on vTaskDelete() api with ctl pressed then I can see the deleration of the api in** task.**h

Here is my code

#include "FreeRTOS/FreeRTOS.h"
#include "task.h"
#include "scheduler_task.hpp"
#include <stdio.h>
#include <stdlib.h>


TaskHandle_t TaskHandler_1;
TaskHandle_t TaskHandler_2;
TaskHandle_t TaskHandler_3;
TaskHandle_t TaskHandler_4;



void enableFlushAfterPrintf()
{
    setvbuf(stdout, 0, _IONBF, 0);
    setvbuf(stdin, 0, _IONBF, 0);
}


 void Task1(void *p){
	for(;;){
		printf("task 1\n");
		vTaskDelete(TaskHandler_1);
	}
}


void Task2(void *p){
	for(;;){
		printf("task 2\n");
		vTaskDelete(TaskHandler_2);
	}
}

void Task4(void *p){
	for(;;){
		printf("Tassk4 is Running\n");
		vTaskDelete(TaskHandler_4);
	}
}

void Task3(void *p){
for(;;){
	printf("task3 is running created task2 and task4\n");
	xTaskCreate(Task2, "task2", 1024, NULL, 2, &TaskHandler_2);
	xTaskCreate(Task4, "task4", 1024, NULL, 4, &TaskHandler_4);
	printf("task 3 is complated after creating task 2 and 4\n");
	vTaskDelete(TaskHandler_3);
}
}




int main(void){
	enableFlushAfterPrintf();
	xTaskCreate(Task3, "task3", 1024, NULL, 3, &TaskHandler_3);
	xTaskCreate(Task1, "task1", 1024, NULL, 1, &TaskHandler_1);
	vTaskStartScheduler();
}

can any one help me ?

davedoors wrote on Thursday, September 15, 2016:

The ‘Task’ at the start of the function name tells you the function is implemented in tasks.c. A quick search for the function in the file shows it is protected by #if ( INCLUDE_vTaskDelete == 1 ). Does your FreeRTOSConfig.h have INCLUDE_vTaskDelete set to 1?

mahendra12345 wrote on Thursday, September 15, 2016:

it was defined as 0
putting 1 solved problem
Thanks…