Creating Project MinGW or MSVC - undefined reference to "xTaskCreate"

andrewalo wrote on Monday, January 12, 2015:

HI all,
I’m newbie with FreeRTOS and i’m trying to compile a simply example application.

If i open the demo application with Microsoft Visual Studio, it works greatly, but once i remove all .c leave only main.c with some simply instatements like xTaskCreate(), cause this errors:

undefined reference to: xTaskCreate();

I’ve tried also to create a new project with include all header, but the result it’s the same.

Toolchain tried: Codeblock and Eclipse Luna with MinGW header and Microsoft Visual Studio with header MSVC

I’ve seen that in the source file, there aren’t .lib or .dll but only .h.

Thanks in advance :slight_smile:

davedoors wrote on Monday, January 12, 2015:

You know you use FreeRTOS by including its source files in your project right? So if you remove >all< the files except main.c you will have removed FreeRTOS.

This link http://www.freertos.org/a00017.html tells you about the source files and directories. The Microsoft Visual Studio project probably includes a folder called something similar to “FreeRTOS Source” which includes the FreeRTOS files.

andrewalo wrote on Monday, January 12, 2015:

Yes, i leave only main.c, in the attachment there is the output:

rtel wrote on Monday, January 12, 2015:

Don’t delete any files from the “FreeRTOS Source” directory in the MSVC
project. They implement the FreeRTOS kernel, so without them your
application will not link.

Regards.

andrewalo wrote on Monday, January 12, 2015:

Now it works, in the attachment there is the output.

I’ve call an extern function called main2 that contains my simple application.

I’ve seen that if there aren’t prvInitialiseHeap() and vTraceInitTraceData(), it throws some exceptions.

This method is right?or i’ve done some mistake?

Thank you all for helping :slight_smile:

rtel wrote on Monday, January 12, 2015:

Really a lot of information has gone into documenting these things. I
think the information you need can be found with a little time
investment reading…

http://www.freertos.org/Creating-a-new-FreeRTOS-project.html
http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html

Whether or not prvInitialiseHeap() is needed or not depends on the
memory scheme used http://www.freertos.org/a00111.html

Whether or not vTraceInitTraceData() is needed or not depends on whether
the trace functionality is included or not
http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_Trace/RTOS_Trace_Instructions.shtml

andrewalo wrote on Monday, January 12, 2015:

Thank you so much guys :slight_smile: