2021-11-11 09:14 AM
I was trying to use the getStorageStructure API function inside the example program which is supplied with STM32CubeProgrammer. The Visual studio solution I was trying to change, inserting the call to the getStorageStructure, is the STM32CubePrgAPI. I simply added these line code in the original file USB_Example.cpp:
storageStructure* storageinfo;
At the beginning of the USB_Example() function...
int ret = getStorageStructure(&storageinfo);
After entering the DFU mode and calling the getDeviceGeneralInf() function.
The problem is that when I build the solution then 2 unresolved external symbol was generated:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _getStorageStructure referenced in function "int __cdecl USB_Example(void)" (?USB_Example@@YAHXZ) STM32CubePrgAPI C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\api\project\Visual Studio\x86\STM32CubePrgAPI\USB_Example.obj 1
I don't know what I'm missing... Any help?
2023-03-06 08:48 AM
The problem is related to the .lib file, which does not contain any reference to the getStorageStructure function. That is why you are getting that LNK2019 error message.
I solved this problem by regenerating the .lib file.
Regards