I am using Freertosv202112.00. I tried to build the source(.c file) files along with headers and created the library(.lib). But while building my freertos application using the library, I am getting the compilation error as
1>freertos_lib.lib(queue.obj) : error LNK2001: unresolved external symbol _vPortFree
1>freertos_lib.lib(timers.obj) : error LNK2001: unresolved external symbol _vPortFree
1>cross_os.lib(os_deallocate_memory.obj) : error LNK2001: unresolved external symbol _vPortFree
1>cross_os.lib(os_delete_memory_pool.obj) : error LNK2001: unresolved external symbol _vPortFree
1>freertos_lib.lib(tasks.obj) : error LNK2001: unresolved external symbol _vPortFree
1>freertos_lib.lib(event_groups.obj) : error LNK2001: unresolved external symbol _vPortFree
1>freertos_lib.lib(queue.obj) : error LNK2001: unresolved external symbol _pvPortMalloc
1>freertos_lib.lib(timers.obj) : error LNK2001: unresolved external symbol _pvPortMalloc
1>cross_os.lib(os_allocate_memory.obj) : error LNK2001: unresolved external symbol _pvPortMalloc
1>cross_os.lib(int_os_config_allocate_system_config.obj) : error LNK2001: unresolved external symbol _pvPortMalloc
1>freertos_lib.lib(tasks.obj) : error LNK2001: unresolved external symbol _pvPortMalloc
1>freertos_lib.lib(event_groups.obj) : error LNK2001: unresolved external symbol _pvPortMalloc
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>freertos_lib.lib(timers.obj) : error LNK2001: unresolved external symbol _vAssertCalled
1>freertos_lib.lib(tasks.obj) : error LNK2001: unresolved external symbol _vAssertCalled
1>freertos_lib.lib(port.obj) : error LNK2001: unresolved external symbol _vAssertCalled
1>freertos_lib.lib(event_groups.obj) : error LNK2001: unresolved external symbol _vAssertCalled
1>freertos_lib.lib(queue.obj) : error LNK2001: unresolved external symbol _vAssertCalled
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _ulGetRunTimeCounterValue referenced in function _uxTaskGetSystemState
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _vConfigureTimerForRunTimeStats referenced in function _vTaskStartScheduler
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _vApplicationGetIdleTaskMemory referenced in function _vTaskStartScheduler
1>freertos_lib.lib(timers.obj) : error LNK2019: unresolved external symbol _vApplicationGetTimerTaskMemory referenced in function _xTimerCreateTimerTask
1>D:\validation_freertos\demo_cross_os\specific\windows\x86\vsnet2015\Debug\demo_cross_os.exe : fatal error LNK1120: 8 unresolved externals
1>Done building project "windows_x86_vsnet2015_demo_cross_os.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Elapsed 00:14.285 ==========
I need a demo application on MSVC which can take the use of freertos lib(lib created from these Freertosv202112.00 source files).
error LNK2019: unresolved external symbol _ulGetRunTimeCounterValue
error LNK2019: unresolved external symbol _vConfigureTimerForRunTimeStats
If you need run time stats, you need to supply these functions - FreeRTOS Run Time Stats. If you do not need, you can set configGENERATE_RUN_TIME_STATS to 0 in your FreeRTOSConfig.h
error LNK2019: unresolved external symbol _vApplicationGetIdleTaskMemory
error LNK2019: unresolved external symbol _vApplicationGetTimerTaskMemory
You need to supply these 2 functions. You can look at the following for reference -
Thank you for your support. I followed your things and the compilation error reduced.
Then I tried to build the source(.c file) files along with headers and created the library(.lib). But while building my freertos application using the library, I am getting the compilation error as
Console output :
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _vApplicationStackOverflowHook referenced in function _vTaskSwitchContext
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _vApplicationGetIdleTaskMemory referenced in function _vTaskStartScheduler
1>freertos_lib.lib(timers.obj) : error LNK2019: unresolved external symbol _vApplicationGetTimerTaskMemory referenced in function _xTimerCreateTimerTask
1>freertos_lib.lib(heap.obj) : error LNK2019: unresolved external symbol _vApplicationMallocFailedHook referenced in function _pvPortMalloc
1>D:\validation_freertos\demo_cross_os\specific\windows\x86\vsnet2015\Debug\demo_cross_os.exe : fatal error LNK1120: 5 unresolved externals
1>Done building project "windows_x86_vsnet2015_demo_cross_os.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Elapsed 00:13.500 ==========
I found the app_main.h file along with mpu_demo.h file. I can able to build the freertos using the source file and header file and created the library. But while compiling my application on MSVC 2022, I am getting the compilation error as
freertos_lib.lib(app_main.obj) : error LNK2019: unresolved external symbol _vStartMPUDemo referenced in function _app_main
We found our configured main() entry function of our sample application. Hence app_main.c, app_main.h and mpu_demo.h files are not needed. Right now I am facing the compilation error which is more likely to configure the FreeRTOSConfig.h. The compilation error as
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _vApplicationStackOverflowHook referenced in function _vTaskSwitchContext
1>freertos_lib.lib(tasks.obj) : error LNK2019: unresolved external symbol _vApplicationGetIdleTaskMemory referenced in function _vTaskStartScheduler
1>freertos_lib.lib(heap.obj) : error LNK2019: unresolved external symbol _vApplicationMallocFailedHook referenced in function _pvPortMalloc
1>freertos_lib.lib(timers.obj) : error LNK2019: unresolved external symbol _vApplicationGetTimerTaskMemory referenced in function _xTimerCreateTimerTask
1>D:\validation_freertos\demo_cross_os\specific\windows\x86\vsnet2015\Debug\demo_cross_os.exe : fatal error LNK1120: 4 unresolved externals
1>Done building project "windows_x86_vsnet2015_demo_cross_os.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Elapsed 00:24.338 ==========
Thank you for your support. As per your suggestions, I fixed the compilation error of my freertos application. Now able to compile the application using the FreeRTOS lib.