Code read protect

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

Code read protect

340件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Muis on Mon Mar 16 22:12:45 MST 2015
I started without CRP, and now I wanted to add it. I enabled it in the Linker settings, and I added:

__CRP const uint32_t CRP_WORD = CRP_NO_CRP ;

to my main.h. But now everytime the linker complains:

      ' multiple definition of `CRP_WORD'' and wont compile.

But if I comment out the CRP_WORD constant from my main.h, it complains:

       Linker CRP Enabled, but no CRP_WORD provided within application


I am sure the CRP_WORD variabele exists only once in my project.

What can be the reason? The only things that are not standard about my project is that the stack is moved to USB ram and I use LTO optimization.
0 件の賞賛
返信
2 返答(返信)

303件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Muis on Tue Mar 17 02:26:40 MST 2015
I feel very noobish right now, but thanks!
0 件の賞賛
返信

303件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Mar 17 00:45:00 MST 2015
If you *define* your variable in your header file, then everywhere that you #include the header file will also get a definition of the variable, leading to multiple definition errors.

You need to *declare* your variable in the header file (if you want to be able to access it from other code). The, just define it in C module.

See
http://www.cprogramming.com/declare_vs_define.html
0 件の賞賛
返信