Link errors for RCC_GetClocksFreq

Sysprogs forums Forums VisualGDB Link errors for RCC_GetClocksFreq

This topic contains 3 replies, has 2 voices, and was last updated by  support 5 months, 4 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27044

    Sherlock
    Participant

    I’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 months, 4 weeks ago by  Sherlock.
    #27046

    support
    Keymaster

    Sorry, 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 months, 4 weeks ago by  support.
    #27054

    Sherlock
    Participant

    Hi, 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

     

     

     

     

    • This reply was modified 5 months, 4 weeks ago by  Sherlock.
    • This reply was modified 5 months, 4 weeks ago by  Sherlock.
    • This reply was modified 5 months, 4 weeks ago by  Sherlock.
    • This reply was modified 5 months, 4 weeks ago by  Sherlock.
    #27059

    support
    Keymaster

    Sorry, 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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.