c files in subdirectories not being checked for linker errors??

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

c files in subdirectories not being checked for linker errors??

235 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wdawson61 on Tue May 03 15:31:21 MST 2011
[B]Lpcxpresso Linux 3.83
Linux 10.04
LPC1754 project
[/B]

I have a project that has a main folder with source files as well subfolders that contain more source files.  If I place a syntactically-correct call to a non-existentfunction in one of the source files contained in a sub-folder, the executable is built with only a minor gripe about "implicit declaration."  If I place a syntax error in the module, the compiler sees it and no executable is built.

If, however, I place the same bogus function call (to a nonexistent function) in one of the source files of the main project folder, I get thet expected "reference to undefined function."


wtf??

Regards,

Wade
0 Kudos
1 Reply

228 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue May 03 21:54:33 MST 2011
The most likely reason for this behaviour would be nothing to do with the use of subfolders, but rather than the function you placed the subroutine call in is not actually being called from elsewhere in your application.

If this is the case, then the linker would (by default) then remove it from the final application - and hence you will not see an undefined linker error. This behaviour by the linker is controlled by the [FONT=Courier New][SIZE=1]--gc-sections[/SIZE][/FONT] linker option.

You can check to see if the function is being removed by looking at the linker map file. [There is some information on linker map files at http://support.code-red-tech.com/CodeRedWiki/FlashRamSize.]

Regards,
CodeRedSupport
0 Kudos