c - bit-declaration - undefined reference to 'variable' -


i have problem , hope, me. try make can-communication between 2 dspic30f4011. works. have make identifier. have use sid , eid. divided 4 parts. want make bit-declaration , error. made new header-file

#ifndef identifier_h #define identifier_h  #ifdef  __cplusplus extern "c" { #endif     #ifdef  __cplusplus } #endif  #endif  /* identifier_h */   #include <p30f4011.h> #include "system.h" #include <p30fxxxx.h>   typedef struct tagcxtxxsidbits{     unsigned          : 11;     unsigned prio4_0  : 5; }cxtxxpriobits;  extern volatile unsigned int c1tx0prio __attribute__((__sfr__)); extern volatile cxtxxpriobits c1tx0priobits __attribute__((__sfr__)); extern volatile unsigned int c1tx1prio __attribute__((__sfr__)); extern volatile cxtxxpriobits c1tx1priobits __attribute__((__sfr__)); extern volatile unsigned int c1tx2prio __attribute__((__sfr__)); extern volatile cxtxxpriobits c1tx2priobits __attribute__((__sfr__)); 

in code want write

... ... c1tx0prio = 0x0000; ... 

if want build project error

build/default/production/can_function.o(.text+0x66): in  function    `.lsm19': : undefined reference `_c1tx0prio' make[2]: *** [dist/default/production/blink.x.production.hex] error 255 make[1]: *** [.build-conf] error 2 make: *** [.build-impl] error 2 

what did wrong? wrote in p30f4011.h

you have variables declared extern in header.

usually need put variable extern in header, if want use variable multiple source files. in way, variable accessible in source files include header. however, in 1 of c files need have following:

volatile unsigned int c1tx0prio __attribute__((__sfr__)); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -