Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[51] C51 code organization

Status
Not open for further replies.

hithesh123

Full Member level 6
Full Member level 6
Joined
Nov 21, 2009
Messages
324
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
lax
Visit site
Activity points
3,548
I am trying organize my code and make it more readable and eazy to debug.
I have my constants in a header file and I need to use this in 2 .c files. Now I am getting the "Multiple public definitions" error.

How do I deal with this.
 

If the variables and functions are declared in header file then use extern specifier in .c files.


I have defined my constant char array in a header file.
These are used in 2 source files.
Now I have to declare them as extern const char in the second source file or should I declare as extern in all the source files which use them?

Let me try to understand this -
When I declare the const char array in a header file, this is both declaration and definition(memory is allocated).
In the source files when I use extern...., this is only declaration. Correct?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top