Undefined reference to Function

Hi Guys

I have been having a problem in developer studio where it is not finding the function prototype in plug-in H files when building. The first time was when I upgraded my location plug-in from Version 1.0.1 to version 1.1.0, and all the GPS functions came up with the error “undefined reference to XXX” where XXX is the function name. The only way I got around it was creating a new project using the location plugin version 1.1.0 at the start, and then copying all my code across.

Now I have tried including the SMS-PDU plug-in (using Properties->Open AT Application->Plug-in, then apply, OK, clean, build), and the functions referenced in the “sms_pdu_encode.h” and “sms_pdu_decode.h” files are giving the same error (“undefined reference to XXX”). The H files are #included, and if I ctrl+click on the function name, it takes me to the prototype in the H file, but it will not compile! I created a new application using the sample, and this worked fine, so it only seems to be a problem if you add a plug-in after the application has been created.

This is very frustrating, and I’m guessing its a Developer Studio problem as it happened with 2 plug-ins. Any ideas?

Thanks!
Tom

Please can you confirm the use case:

  • You have a project depending on, let’s say, C-GPS plug-in in version 1.01
  • You install a new version of the plug-in: 1.10
  • You modify the properties of the project to make it depend on this plug-in version
  • From there, it seems that plug-in libraries are not linked anymore, since plug-in functions are not found by the linker.

What is your DS version?
Can you systematically reproduce the issue?
Thanks for your answers.

Hi Daav

What you have stated is correct. It seems like it is only applicable to NEW plug-ins in the package, for example, Location Plugin 1.1.0 and SMS-PDU plugin.

It also occurs when:

  • I have an existing project
  • I want to use an new plug-in, for example, SMS-PDU
  • I include the plug-in, however the library is not linked correctly and the function calls generate an error

I am using Developer Studio 2.0.0. Here are steps to reproduce the error:

  1. Create a new Open AT project, without selecting any plug-ins
  2. Build the project - should build correctly.
  3. Add the SMS-PDU plug-in
  4. Add the required headers: #include “sms_pdu_decode.h” & #include “sms_pdu_encode.h”
  5. Add a function call from the plug-in, eg: smrx_pdu_decode_no_smsc
  6. Build the project
  7. Error occurs: Link error: undefined reference to `smrx_pdu_decode_no_smsc’

A solution is to include the plug-in when creating the project, but it means creating a new project whenever you want to add a plug-in and copying code across.

Mmmm…
Seems that there is something to check with the toolchain choice.
It appears that SMS-PDU plug-in only supports build with ARM ELF GCC toolchain.
The explanation should be:

I-
When you create a blank project without the dependency on SMS-PDU, DS automatically selects the ARM EABI GCC toolchain by default (and only it). When you add the SMS-PDU dependency, it can’t be built with ARM EABI GCC (the library is not provided) and the link fails.
From there, you should add an ARM ELF GCC build configuration (menu File > New > Open AT Configuration when the project is selected) to be able to build the project with the SMS-PDU dependency.

II-
When you create the project including the SMS-PDU dependency from the beginning, DS restricts the toolchain choice to propose (and select) only ARM ELF GCC one. The project is then immediately created with the right configuration and can be built with success.

Please note that I can’t reproduce the issue with Location plug-in… At least to have the opposite use case: Location plug-in doesn’t provide libraries for ARM ELF GCC toolchain, and can’t be linked in this configuration.

Looks like you’re correct about SMS-PDU only being compatible with ELF. This is unfortunate, as I am using the Location plug-in 1.1.0, which as you said is only compatible with EABI. Looks like I’ll have to wait until SMS-PDU supports EABI :frowning:

Indeed. Don’t hesitate to push the request through your distributor.

Will do. Thanks for your help.