Re: problem with compiling different C files with a global structure





On Tue, May 11, 2010 at 3:54 AM, Leon Opit <leon opit locsoft com> wrote:
Hi Debmalya,

Do not use automatic initialisation in variables with the extern attribute.

Initialise a.data by assignment in main().
ok, I'll keep that in mind. 
This is not the whole story but then your example code is not exactly what you tried to compile!

(calling cal() in main() ) but defining call in call.c never-the-less you get the idea)

eh, that was a typo ! 
Leon

On 11 May 2010 07:04, Debmalya Sinha <sunnywizard gmail com> wrote:
Hello, 

Though this might not be the place for this type of query, this problem I'm giving here is a simplest scale version of a problem when I am trying to split up a large gtk source code of mine.


I'm trying to compile a program with 3 diff C files.
main.c
call.c
global.c

I want to declare a global structure variable and assign a value to it's content in main.c
then I  will call another function (declared at call.c ) to print the global variable.

I have a structure definition in global.c which I have declared as extern in the common header file head.h through another header file global.h

Program is not compiling.

Am I missing some points here?


--
Regards,

Debmalya Sinha

Research Scientist,
MS(R) student,
Computer Science and Engineering
IIT Kharagpur


Fedora Ambassador
Chandannagar
India.

sunnywizard.googlepages.com


GPG Key : 6E2BD51B
Keyserver : http://pgp.mit.edu

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list





--
Regards,

Debmalya Sinha

Research Scientist,
MS(R) student,
Computer Science and Engineering
IIT Kharagpur


Fedora Ambassador
Chandannagar
India.

sunnywizard.googlepages.com


GPG Key : 6E2BD51B
Keyserver : http://pgp.mit.edu


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