I'm getting errors from Linker like:
osd.o (.ndata + 0x514): C: \ Documents and Settings \ Thomas \ My Documents \ PIC \ dsPIC33FJ128GP802 \ Display on screen \ osd.c: Multiple definitions (.andata + 0x0) of 'video_buff_vis_num' main.o: C: \ Documents and Settings \ Thomas \ My Doc \ Picture \ dsPIC33FJ128GP802 \ Display on screen \ main.c: First defined here osd.o (.ndata + 0x515): C: \ Documents and Settings \ Thomas \ My Documents \ PIC \ d SPIC33FJ128GP802 \ On Screen Display \ Osd.c: Multiple definitions (.ndata + 0x1) of `video_buff_draw_num 'main.o: C: \ Documents and Settings \ Thomas \ My Documents \ PIC \ dsPIC33FJ128GP802 \ Screen \ display \ main.c : First defined here osd O (.ndata + 0x516): C: \ Documents and Settings \ Thomas \ My Documents \ Picture \ dsPIC33FJ128GP802 \ Display on screen \ osd.c: Multiple definitions of 'vid_format' main.o (.ndata + 0x2): C: \ Documents and Settings \ Thomas \ My Documents \ Picture \ dsPIC33FJ128GP802 \ Screen Render \ main.c: osd.o (.ndata + 0x518) defined here: C: \ D Ocuments and Settings \ Thomas \ Display on my document \ PIC \ dsPIC33FJ128GP802 \ screen \ osd.c: `vid_line 'main Multiple Definition (.ndata + 0x4) of .o: C: \ Documents and Settings \ Thomas \ Display on my document \ PIC \ DsPIC33FJ128GP802 \ screen \ main.c: previously defined here This is bothering me, because in the source code I have only one guards around the same place These definitions can come. Including definitions for /p>
#ifndef OSD_H # code OdiDH HD code, #endif // OSD_H above, this is happening on my nerves I cleaned up Done, made it again, and tried it again i started a new project from scratch with the same file and i am getting the same problem! Will someone tell me why this is not working! :)
Compile with PIC-GCC v3.23 (GIC version of PIC 24F / H and DSPICFF / 33F microcontrollers).
I know that any source wants to see more files I did not want to crush this page.
If you include this header in more than 1 code>. You will have several definitions in the C file and you have main.c and osd.c .
The correct location for the .h function and extract data declarations but for a variable you have a source files would choose. #defined Guards do not change this.
Also see. And describes the standard pattern.
And a little more clarification / analysis:
1) Each .c source file is compiled independently . The guard protects the header file from being read twice only during the compilation.
2) The error you are receiving is a linker (not a compiler) error.
When your header defines a variable, then the compiler will treat it as a definition in each separate part. Linker will explore many examples.
Comments
Post a Comment