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



Debmalya Sinha <sunnywizard gmail com> writes:

> 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.

First...

http://www.catb.org/~esr/faqs/smart-questions.html

Second...

Every piece of your code that wants to fondle that global needs two
things.  It needs to know the structure's definition and it needs to
know that the global exists.

Does every piece of your code have access to this information?

Are you getting compilation errors or linking errors?  Which you are
getting and where they are comming from will tell you precisely why your
build is failing.

Maybe you should hack out a minimal test-case with two .c files and one
common header and see if your assumptions about how this works are
correct.  It will be easier for you to debug the problem if you boil it
down.

This *is* a very basic C question you should already know the answer to
before you start playing with something like gtk.  If your understanding
of extern et al is sketchy, I can't imagine life being happier for you
once you start getting into the pointers, callbacks and signal/event
handling that forms the core of gtk.

For what it's worth.

Jeff


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