Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Definition in Header files
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Madhur, post: 3108022"] I have problems faced in adding definitions in the command header file. I have defined a header file which includes huge set of global constants and I am using them in all the C files. For example my sample.h file looks like this /************* File : sample.h ****************/ const int a1 = 0; const int a2 = 0; /****End of sample.h*********/ My source code looks like this /***************** File:sample1.c ***********/ #include "sample.h" int main() { } /*****End of sample1.c************/ /*************** File : sample2.c **************/ #include "sample.h int main() { } /*******End of sample2.c**********/ Now the problem is during linking it says multiple definition of symbols a1 and a2. I can avoid this problem by having a C file which contains the definitions and H file for declarations. But is there any way I can avoid doing this. Please let me know. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Definition in Header files
Top