Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-27-2006, 04:29 PM   #1
LQ Newbie
Registered: Jun 2006
Posts: 12

Rep: Reputation: 0
Angry Building make files

Whaat is the simplist makefile I can design to compile a single gtk program?

Here's what I have...

hello: hello.c
gcc hello.c -o hello

It gives me an error:

makefile:2: *** missing separator. Stop.
Old 06-27-2006, 04:32 PM   #2
Senior Member
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
try putting a tab on the second line... or any line that starts with gcc.
Old 06-27-2006, 04:53 PM   #3
Senior Member
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
As nadroj said, every action needs to start with a tab for histerical raisons.
Another good idea is to take advantage of make's implicit rules.
CC = gcc
CFLAGS = -g -Wall
make will compile the program using CC and with CFLAGS, which are to compile with debug info and turn on all warnings.
Old 06-28-2006, 04:54 AM   #4
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
Here's a simple 'Makefile' to compile and link the 'helloworld.c' exmaple from the GTK2 tutorial:
CC = gcc
CFLAGS = -g -Wall `pkg-config --cflags gtk+-2.0`
LIBS =  `pkg-config --libs gtk+-2.0`

helloworld: helloworld.o
	$(CC) $(LIBS) -o helloworld helloworld.o

helloworld.o: helloworld.c
	$(CC) $(CFLAGS) -c -o helloworld.o helloworld.c
Please note that, as nadroj and tuxdev already pointed out, the empty spaces in front of the lines that begin with "$(CC)" must be TABS.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
KDevelop not building files sghod1212 Mandriva 2 12-22-2005 05:48 PM
Make files disruptive Programming 5 12-02-2005 09:33 PM
Building evolution 1.2.1: make error Hcman Linux - Software 5 02-16-2003 06:02 AM
Make files rao Programming 3 07-18-2002 01:20 PM
Building RPM files from TAR files parle Linux - Software 3 05-05-2002 11:02 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration