Re: including my own .h files....



You've got a Makefile problem.  Did you build the Makefile by hand, or
use automake?


In this line:
> gcc `gtk-config --cflags` -g -Wall   -c -o tvplug.o tvplug.c

I would typically expect NOT to see any "-o tvplug.o", as I think the
default is to produce a .o and stop, after compiling.  For example, when
I compile I see lines like:

gcc -g -O2 -Wall -c avd_main.c

for each .c file in my project.  (I've deleted -I and -D options from
that line, to simplify the example).

Then your line:
> gcc studio.c -o studio `gtk-config --cflags` -g -Wall `gtk-config --libs

looks as if it should compile studio.c into the final application
"studio", but doesn't mention the tvplug.o file at all.  Hence, the
linking failure, since that run of gcc knows nothing about the previous
compilation.

Once all of the .c files in my projects have been compiled into .o's,
there's a separate gcc call to build the executable.  It looks like
this:

gcc -g -O2 -Wall  -o avdisplay  avd_main.o avd_support.o avd_interface.o 

This links avd_main.0, avd_support.o, and avd_interface.o into the
output executable "avdisplay" specified by the -o option.  (Again, I've
deleted lots of -L and -l options from that line.)

I suggest either:

1) Download the GNU Make documentation, in book form, and read the first
couple chapters.  Build your projects in two stages, .c -> .o, then .o's
-> executable, by hand a few times to understand the process.  Then
start creating a Makefile to build your project.

2) Use a tool to set up a standard GNU build directory.  This may
require that automake and autoconf are installed.  I've used
'autoproject' with success (I forget the homepage, see
www.freshmeat.net).  I've also created a project with glade, selected
"Write source code", and gotten a fairly good start.  I then add my
other .c and .h files to the Makefile.am file, rerun automake, and go.  

Caveat:  I have not tried building my glade-started app under anything
but Solaris, so it may not be correctly checking everything with
"configure" that needs doing.  The autoproject started app is not quite
perfect on Solaris vs. Cygwin building, but it definitely was a start.  

Hope this helps,

Eric Monsler




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