GNU Linker not resolving a symbol

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GNU Linker not resolving a symbol

963 Views
richardfox75
Contributor III

Using KDS 3.00 with all of the latest updates installed. For some

reason the linker is not resolving the address of one symbol.

I have a function say App_Run() in one C file and the call of

the function in another C file. At the completion of my project

build the Linker gives an error message that my App_Run()

is undefined.

 

Looking at the dis-assembly of the two files shows the

function definition in one file and the function call in the

other file. Have not been able to successfully build my

project. Have to comment out the function call for the

project to build. Cannot figure out why the Linker

is complaining.

Labels (1)
0 Kudos
Reply
7 Replies

840 Views
bobpaddock
Senior Contributor III

On this assumption:

file.h has void App_Run( void );

file.c has void App_Run( void ){ }

and they are not linking check the file.h header guard to see if it is using the same define as some other header.

The 'simple' project won't include duplicated header guard which is why it works and the real one does not.

Add:

#error Am I here?

to file.h and see if complication stops at that point, as it should if the header really being used.

0 Kudos
Reply

840 Views
DavidS
NXP Employee
NXP Employee

Hi Richard,

Have you declared a prototype in the source "C" file and then declared it extern in the second/calling location?

ex:  main.c has the function App_Run(); in it but at top of file you have prototype void App_Run(void);

in SomeOtherFile.c you have prototype at top of file like following:

extern void App_Run(void);

Later in some function you call it as follows:

App_Run();

Is that how you have it configured?

Any chance the call is in a piece of code that actually does not get called?

Regards,

David

0 Kudos
Reply

840 Views
richardfox75
Contributor III

David,

Thanks for the response. Yes I have declared a prototype with and without

adding "extern" to the definition. The function that I am having a problem

with is the first call in main() to initialize the HW and SW, so it is

definitely being called.

I have tried everything that I can think of. My processor is a Kinetis

MK22FN with 256K of Flash memory. The size of my application is

just under 12K.

Problem is that I am modifying third party SW which is using the

main() to call every other function in the application. So it would be

tedious to start stubbing code out, and then trying the link.

I have another project which is very similar, but much smaller, and

it builds correctly.

Dick Fox

Firmware Engineer

NATIONAL CONTROLS CORPORATION BUSINESS UNIT

INSTRUMENTATION AND SPECIALTY CONTROLS DIVISION

1725 Western Dr | West Chicago, IL 60185 | http://www.ametekncc.com

Phone: (630)621-3118 | email: Dick Fox@ametek.com

0 Kudos
Reply

840 Views
DavidS
NXP Employee
NXP Employee

Hi Richard,

Have you applied this patch:

Solving the 8192 Character Command Line Limit on Windows | MCU on Eclipse

Regards,

David 

0 Kudos
Reply

840 Views
richardfox75
Contributor III

Hello David,

Yes I have applied the patch. It did not solve my problem.

Regards,

Dick Fox

Firmware Engineer

NATIONAL CONTROLS CORPORATION BUSINESS UNIT

INSTRUMENTATION AND SPECIALTY CONTROLS DIVISION

1725 Western Dr | West Chicago, IL 60185 | http://www.ametekncc.com

Phone: (630)621-3118 | email: Dick Fox@ametek.com

0 Kudos
Reply

840 Views
DavidS
NXP Employee
NXP Employee

Hi Richard,

Sorry that was not the solution.

Can you post a simplified version of the project with the issue?

FYI - I'm heading out tomorrow on Bereavement followed by Holiday PTO.  I will try to point someone else to help.

Regards,

David

0 Kudos
Reply

840 Views
richardfox75
Contributor III

David,

I would like to but the SW is proprietary, so I am not allowed

to release it. A "simple" version of the project works correctly.

I am guessing that somehow it is the 3rd party SW. It was

developed to execute on an 8051 using the old Franklin C

compiler.

I appreciate your offer to help.

Regards,

Dick Fox

Firmware Engineer

NATIONAL CONTROLS CORPORATION BUSINESS UNIT

INSTRUMENTATION AND SPECIALTY CONTROLS DIVISION

1725 Western Dr | West Chicago, IL 60185 | http://www.ametekncc.com

Phone: (630)621-3118 | email: Dick Fox@ametek.com

0 Kudos
Reply