Re: Defining new variables for use in multiple c files. How do I create header files that can be #included in multiple c files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 9, 2008 at 10:56 PM, Bradley Hanna <brahan.ml@xxxxxxxxx> wrote:
> I am trying to define a variable that needs to be manipulated by one c
> file in the kernel and read by another c file in a different directory.
> I have defined the variable in a header file that is #included in both c
> files.  The problem is when I compile the kernel I get an error saying
> that the variable cannot be defined more than once.  I added a
> preprocessor condition like this:
>
> #ifndef _NEW_HEADER_H
> #define _NEW_HEADER_H
>
> //define the variable
>
> #endif
>
> it was my assumption that the variable would only be defined once
> because of this macro but I am still having the same problems.
>
> How do I create header files that can be #included in multiple c files
> like the files in the source tree?
>
> thanks for you patience,
>
> -brahan
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>
Hi ,

Perhaps using extern can solve your problem.
See this

http://bytes.com/forum/thread213279.html

Dan.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux