Disable automatic external object creation by linker

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

Disable automatic external object creation by linker

Jump to solution
759 Views
rvumbaca
Contributor I

Hi,

 

I am using CW for MCU 10.6 with HCS08.

 

If I define an extern variable but it is not actually declared anywhere (or if I set it to 'static' and try to access it from a different module using an 'extern' declaration) the linker will generate the warning L1823 and will automatically create the object locally.

 

I do not want this behaviour, instead I want a linker error to be generated as expected.

 

Is it possible to disable this 'feature' in the linker? I have looked through the options and searched through these forums, but have found no solution.

 

Thanks,

 

Rosario

Labels (1)
0 Kudos
1 Solution
570 Views
BlackNight
NXP Employee
NXP Employee

Hi Rosario,

you can map that warning message to an error with the following linker option:

-WmsgSe1823

That way it does not create such an automatic object.

I hipe this helps,

Erich

View solution in original post

0 Kudos
4 Replies
570 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

hi Rosario,

there are two methods to disable warnings:

(1).  add option-WmsgSd<number>  to Linker setting.<number>: Message number to be disabled, e.g., 1801

Example     -WmsgSd1823

(2). use #pragma OPTION ADD "-WmsgSd1823"
   in C code. for more information about #pragma OPTION  usage, please see CW help manual.

Hope this helps!

Best Regards,
Zhang Jun

=========================================

this answer is for you. if it helps, please click on "Correct Answer" button. Thanks!


0 Kudos
570 Views
rvumbaca
Contributor I

Hi Jennie,

That pragma cannot be used to supress messages, to do that you use #pragma MESSAGE DISABLE

But I *Do Not* want to hide the message, I want to *Stop Automatic Object Creation*. I have looked through the manuals and it seems that this is not possible.

Regards,

Rosario

0 Kudos
571 Views
BlackNight
NXP Employee
NXP Employee

Hi Rosario,

you can map that warning message to an error with the following linker option:

-WmsgSe1823

That way it does not create such an automatic object.

I hipe this helps,

Erich

0 Kudos
570 Views
rvumbaca
Contributor I

Hi Erich,

Thanks! That solved the problem.

Regards,


Rosario

0 Kudos