The tutorial I am following is the automake hello world. I am compiling a code using GTK+2 and C language
hp@ubuntu:~/amhello$ autoreconf --install
configure.ac:2: installing `./install-sh'
configure.ac:2: installing `./missing'
src/Makefile.am: installing `./depcomp'
hp@ubuntu:~/amhello$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
hp@ubuntu:~/amhello$ make
make all-recursive
make[1]: Entering directory `/home/hp/amhello'
Making all in src
make[2]: Entering directory `/home/hp/amhello/src'
Makefile:448: *** missing separator. Stop.
make[2]: Leaving directory `/home/hp/amhello/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/hp/amhello'
make: *** [all] Error 2
This is the line number 448 of Makefile
~/amhello % cat src/Makefile.amz
My code C is as below
#include<config.h>
#include<stdio.h>
#include<gtk/gtk.h>
void static call(GtkWidget *widget,gpointer data)
{
g_print("%s \n",(gchar*) data);
}
int main(int agrc, char *agrv[])
{
gtk_init(&agrc,&agrv);
GtkWidget *window,*button;
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window,"delete-event",G_CALLBACK(gtk_main_quit),NULL);
gtk_window_set_title(GTK_WINDOW(window),"one button");
button=gtk_button_new_with_label("hello world");
g_signal_connect(button,"clicked",G_CALLBACK(call),(gpointer) "hello world");
gtk_container_set_border_width(GTK_CONTAINER(window),10);
gtk_container_add(GTK_CONTAINER(window),button);
gtk_widget_show_all(window);
gtk_main();
return (0);
}
Contents of the src/Makefile.am are given below
bin_PROGRAMS = hello
hello_SOURCES = main.c
I figured out what was the error now another error is occuring when I use make command
hp@ubuntu:~/amhello$ make
make all-recursive
make[1]: Entering directory `/home/hp/amhello'
Making all in src
make[2]: Entering directory `/home/hp/amhello/src'
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
main.c:3:20: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.
make[2]: *** [main.o] Error 1
make[2]: Leaving directory `/home/hp/amhello/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/hp/amhello'
make: *** [all] Error 2
You likely made an error when copying and pasting the text for
Makefile.am
andsrc/Makefile.am
from the websiteSpecifically there are TWO DIFFERENT files here -
src/Makefile.am
should contain the two linesMakefile.am
should contain the two linesYou probably pasted everything (including the line
~/amhello % cat Makefile.am
) into yoursrc/Makefile.am
file