armeclipse-cdtcodesourcery

Eclipse CDT - errors: "undefined reference to n"?


I'm not entirely sure if this belongs here or on electronics.stackexchange.com, but since this is to do with IDE setup, and compilation, I believe this is the best place to ask my question.

I've got a C project setup in Eclipse CDT. It uses the Sourcery CodeBench Lite ARM toolchain from Mentor Graphics. I've got the Eclipse CDT, as well as GNU ARM Eclipse plugins installed, and trying to setup the ST.com STM32F4 Discovery examples to compile in Eclipse CDT.

When compiling, the compiler is outputting over 200 errors (shortened for brevity):

.../main.c:75: undefined reference to `STM_EVAL_PBInit'
.../main.c:77: undefined reference to `STM_EVAL_LEDInit'
.../main.c:78: undefined reference to `STM_EVAL_LEDInit'
.../main.c:79: undefined reference to `STM_EVAL_LEDInit'
.../main.c:80: undefined reference to `STM_EVAL_LEDInit'
.../main.c:83: undefined reference to `RCC_GetClocksFreq'
.../main.c:86: undefined reference to `STM_EVAL_PBGetState'
.../main.c:89: undefined reference to `STM_EVAL_LEDOn'
.../main.c:90: undefined reference to `STM_EVAL_LEDOn'
.../main.c:91: undefined reference to `STM_EVAL_LEDOn'
.../main.c:92: undefined reference to `STM_EVAL_LEDOn'

Nearly all these items are defined in stm32f4_discovery.h, but for some reason, they are not being resolved during compilation.

I've checked, and double checked that the file is made available C/C++ General > Paths and Symbols, Includes tab, but not sure why things aren't working out.

enter image description here

The project is available on GitHub, for anyone wanting to checkout and try the compilation themselves.

I also created a ticket on Github, as I didn't want to flood here with output information.

Simply clone https://github.com/josefvanniekerk/stm32f4-discovery.git, import stm32f4-discovery/projects/demonstration into Eclipse CDT, and try the compilation.

The Sourcery CodeBench Lite toolchain is compiled on Mac OS X from arm-cs-tools-build.sh, and the Eclipse GNU ARM plugin is required, and can be installed into Eclipse using their update site


Solution

  • Turns out I just needed to add the external sources under

    C/C++ General > Paths and Symbols > Source Location

    Still some errors, but not relating to this question anymore. :)