Thanks Olivier and all,
The static was the culprit.


 
-- 
Rudra
JRF; SNBNCBS
http://www.bose.res.in/~rudra

A bus station is where a bus stops. A train station is where a train
stops. On my desk I have a work  station.

Please, if possible, don't  send me MS Word or PowerPoint attachments 
Why?See:  http://www.gnu.org/philosophy/no-word-attachments.html



________________________________
 From: Olivier Sessink <oliviersess...@gmail.com>
To: gtk-app-devel-list@gnome.org 
Sent: Friday, 31 August 2012 4:02 PM
Subject: Re: compile multiple source file
 
On 08/31/2012 04:48 PM, Rudra Banerjee wrote:
> If they are in separate file, then,
> $ gcc `pkg-config --cflags --libs gtk+-3.0` hello.c main.c -c
> main.c: In function ‘main’:
> main.c:13:5: error: ‘hello’ undeclared (first use in this function)
> main.c:13:5: note: each undeclared identifier is reported only once for
> each function it appears in
> 
> But obviously, putting both of them together in a single file works.
> How to compile while keeping them seperate

first remove the 'static' keyword before function hello(), static
functions are only called from the file itself, they are not to be
called from other files.

now create a header file hello.h that contains:

void hello( GtkWidget *widget, gpointer   data );

and include that in main.c like #include "hello.h"

now you can compile each .c file, and then link the resulting .o files
to a binary.

Olivier


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to