Sysprogs forums › Forums › VisualGDB › Link errors for RCC_GetClocksFreq
- This topic has 3 replies, 2 voices, and was last updated 5 years, 1 month ago by
support.
-
AuthorPosts
-
January 14, 2020 at 00:49 #27044
Sherlock
ParticipantI’m working on a simple experimental app and found RCC_GetClocksFreq mentioned here.
I therefore tried to modify my code and ended up adding an include <stm32f4xx_rcc.h> and the code then compiled.
But it won’t build, at link time it cannot find the definition for the function.
This is a simple C app that currently toggles an LED (this works and runs) and I wanted to explore these RCC functions but cannot.
Is there anything anyone can suggest?
My board is an STM32F407G-DISC1, I’m running Visual Studio Enterprise 2019 and VisualGDB Custom Edition.
Thanks
-
This topic was modified 5 years, 1 month ago by
Sherlock.
January 14, 2020 at 00:59 #27046support
KeymasterSorry, this looks like an STM32-specific problem and not something specific to VisualGDB. Please consider asking on the STM32 forums instead.
Update: Please also consider looking through this tutorial. Although it involves a Linux-based project, it explains the difference between the C/C++ function declarations and definitions and might be helpful in troubleshooting the issue.
-
This reply was modified 5 years, 1 month ago by
support.
January 14, 2020 at 16:55 #27054Sherlock
ParticipantHi, OK I’ve done as you suggested and started discussing this on the STM32 site.
However I wonder if I’m doing something wrong here.
In order to call RCC_GetClocksFreq I searched the web for info to get the name of the .h file that declares this function.
I found that it was in stm32f4xx_rcc.h and simply embedded the include for that into my source – but was that wrong?
Should I add these files and their sources into the solution explorer?
I can see that the project (as created when I created the new VisualGDB project) has solution explorer folders like Device-specific files and LL and so on, should I be adding files to the project by adding them to solution explorer?
How would one typically go about adding a call to a function that’s not defined in any of the headers currently being included in my mainapp.c file?
Is there any documentation about how to do these kinds of project tasks with VisualGDB?
Thanks
January 14, 2020 at 17:22 #27059support
KeymasterSorry, as the steps for this are the same for all C/C++ IDEs, hence there is no specific VisualGDB documentation for this point.
Indeed, adding the .c file providing the function definition to Solution Explorer should solve the problem. You can read more about C/C++ declarations vs. definitions in the following thread: https://stackoverflow.com/questions/1410563/what-is-the-difference-between-a-definition-and-a-declaration.
-
This topic was modified 5 years, 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.