I’m working on a demo project from FreeRTOS on GitHub. I followed the instructions on the website and some YouTube videos. However, when I started building the project, I encountered some errors that I don’t understand. I’ve attached detailed of the errors below. I’m just a newbie, could someone please help me,thanks?
“cannot open source file “stdio.h”
cannot open source file “FreeRTOS.h”
cannot open source file “task.h”
cannot open source file “timers.h”
cannot open source file “semphr.h”
unrecognized token
‘#’ not expected here
identifier “TimerHandle_t” is undefined
identifier “QueueHandle_t” is undefined
identifier “NULL” is undefined
identifier “TimerHandle_t” is undefined
identifier “NULL” is undefined
identifier “TickType_t” is undefined
identifier “uint32_t” is undefined
identifier “NULL” is undefined
identifier “configMINIMAL_STACK_SIZE” is undefined
identifier “tskIDLE_PRIORITY” is undefined
identifier “pdTRUE” is undefined
identifier “TickType_t” is undefined
identifier “TickType_t” is undefined
identifier “uint32_t” is undefined
identifier “TimerHandle_t” is undefined
identifier “uint32_t” is undefined
identifier “uint32_t” is undefined
identifier “portMAX_DELAY” is undefined
identifier “NULL” is undefined
identifier “portMAX_DELAY” is undefined
The VCToolsInstallDir property is not defined. Some build tools may not be found.
The WindowsSDKDir property is not defined. Some build tools may not be found.
Failed to locate: “CL.exe”. The system cannot find the file specified.”
I start with Win32-MSVC from the demo directory, then I click Local Windows Debugger, and the errors I mentioned above appear.
some information from output windows :
"Build started at 9:31 PM…
1>------ Build started: Project: RTOSDemo, Configuration: Debug x64 ------
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(515,5): warning MSB8003: The VCToolsInstallDir property is not defined. Some build tools may not be found.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(516,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
1>TRACKER : error TRK0005: Failed to locate: “CL.exe”. The system cannot find the file specified.
1>Done building project “WIN32.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 9:31 PM and took 01.870 seconds ==========
"
My hypothesis is that the environment setup is incorrect; however, the error seems to indicate that the included file doesn’t exist. I have no clue about this.
You are correct in your hypothesis that your build environment is wrong.
You need to install or repair Visual Studio 2022 to add C++ development tools:
Open Visual Studio Installer.
Select Modify on your current Visual Studio 2022 installation.
Under the Workloads tab, make sure the following are installed:
Desktop development with C++
(Optional but good) Windows 10 SDK or Windows 11 SDK.
Restart Visual Studio.
Then you can re-run the FreeRTOS Demo and see if it works.
Hey @Black018872,
Welcome to the community. The errors you got could also occur because of the following issue:
While cloning the FreeRTOS repository you did not clone the submodules. This happens when we do not clone the repository with the --recurse-submodules flag. If this was the case, you can now simply run the following command from the root of the repository:
git submodule update --init --recursive
This would fetch and clone all the code for the submodules present in the repository and the demo code should build successfully.