Linking Problem
Hello
I have a basic crossworks program with 3 include lines
#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
These files reside in the same directory as the main.c file
The build process fails at the linking stage
Linking Blue-Pill.elf
Blue-Pill THUMB Debug/main.o: in function `main':
undefined reference to `GPIO_ResetBits'
Build failed
GPIO_ResetBits exists within stm32f10x_gpio.h
I have added
BUILD_ALL and gcc to the project Preprocessor Definitions, however the build process is still failing
Suggestions would be appreciated
Thank you
-
The header file gpio.h describes functions that you call from your main.c source code file. These show the compiler _how_ to call those functions (it "declares" those functions including GPIO_ResetBits() ). But it does not tell the compiler what the functions actually do.
The functions are actually "defined" in another file stm32f10x_gpio.c which you need to tell Crossworks to compile and link in.So you could put a copy of stm32f10x_gpio.c into the directory that has main.c. And then from the project explorer in Crossworks right-click on your project or the "Source Files" folder and do "Add existing file..." and select stm32f10x_gpio.c
Then next time you build the necessary functions will be compiled and linked in. You might also need to do the same for stm32f10x_rcc.c.
Hope this helps,
Danish
Please sign in to leave a comment.
Comments
1 comment