Disable automatic external object creation by linker

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Disable automatic external object creation by linker

ソリューションへジャンプ
815件の閲覧回数
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

ラベル(1)
0 件の賞賛
1 解決策
626件の閲覧回数
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 件の賞賛
4 返答(返信)
626件の閲覧回数
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 件の賞賛
626件の閲覧回数
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 件の賞賛
627件の閲覧回数
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 件の賞賛
626件の閲覧回数
rvumbaca
Contributor I

Hi Erich,

Thanks! That solved the problem.

Regards,


Rosario

0 件の賞賛