in Getting started by

Trying to implement USB OTG FS for my project. I generated code with STM32CubeMX to initialize the USB periheral and added it to my project. I am getting the following error when I build the app, 

Description    Resource    Path    Location    Type
undefined reference to `HAL_HCD_Init'    ew_bsp_inout.c    /STM32F746-Discovery/TargetSpecific    line 427    C/C++ Problem

The method HAL_HCD_Init is in the stm32f7xx_hal_hcd.c file. This file doesn't appear in the stm32f7xx_HAL_Driver folder in STM32CubeIDE project explorer. 

But yet if I look at that folder with Windows file explorer I see it. 

10 of the HAL driver files do not appear in STM32CubeIDE project explorer file tree. What is causing this. 

The project is for the STM32F746G Disco board. I have been working on this project for some time now. I have implemented PWM successfully by generating code in STM32CubeMX and copying and pasting it into the STM32CubeIDE project.

1 Answer

0 votes

Hi ezed413,


actually this isn’t a bug, it’s a feature :D

As you can see in the small icon of the files within the HAL folder, these files are ‘Linked Resources’. This means that the files itself aren't located in the project folder. They are symbolic links to dedicated files, and these linked files you have to add manually.


Therefore please follow these steps:

1. Right click on the project -> New -> File


2. Advanced -> Link to file in the files system -> Browse

Then please navigate to the path of the missing .c file. This step is usually just necessary for .c files. Now, please add all missing files with this feature.

3. Right click on the project -> Properties

Even without making the paths relative, the project will have the missing references now, but please always make the paths relative.


4. Resource -> Linked Resources -> Tab: Linked Resources



5. Edit the paths of the newly added files so that they become to relative paths. In our built environment replace everything before ‘ThirdParty‘ with ‘${PARENT-4-PROJECT_LOC}‘. This actually means the same as “..\..\..\..”.


The reason for this principle is to make the project shareable in case that several developer use it at the same time. I highly recommend to following this principle every time when you add (linked) files that comes from a third party.


Best regards,




Hi Tim,

You're the man! Been trying to figure this out for a few days! My project is building without errors. I had to link to two files!

Thank you so much!

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint