From owner-freebsd-questions@FreeBSD.ORG Wed Mar 19 02:59:40 2008 Return-Path: Delivered-To: FreeBSD-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0278D1065671 for ; Wed, 19 Mar 2008 02:59:40 +0000 (UTC) (envelope-from ejcerejo@optonline.net) Received: from mta3.srv.hcvlny.cv.net (mta3.srv.hcvlny.cv.net [167.206.4.198]) by mx1.freebsd.org (Postfix) with ESMTP id CE5158FC16 for ; Wed, 19 Mar 2008 02:59:39 +0000 (UTC) (envelope-from ejcerejo@optonline.net) Received: from localhost (ool-44c03822.dyn.optonline.net [68.192.56.34]) by mta3.srv.hcvlny.cv.net (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with SMTP id <0JXY00NU7IZD1M90@mta3.srv.hcvlny.cv.net> for FreeBSD-questions@FreeBSD.org; Tue, 18 Mar 2008 22:59:39 -0400 (EDT) Date: Tue, 18 Mar 2008 22:59:36 -0400 From: Eduardo Cerejo To: FreeBSD-questions@FreeBSD.org Message-id: <20080318225936.9ef5af16.ejcerejo@optonline.net> MIME-version: 1.0 X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; i386-portbld-freebsd7.0) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Cc: Subject: Gcc and make not producing executable X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Mar 2008 02:59:40 -0000 Hello, I'm trying to get my feet wet in programming in C and the first thing I'm doing is reading a book called an Introduction to GCC. I'm running Fbsd 7-stable I have Gcc44 installed. Example in the book is 3 files named main.c, hello_fn.c and hello.h: File main.c with the following code: #include "hello.h" int main (void) { hello ("world"); return 0; } File hello_fn.c with the following code: #include #include "hello.h" void hello (const char * name) { printf ("Hello, %s!\n", name); } and hello.h with the following code: void hello (const char * name); Objective is to create a makefile which will create an executable named main. The books has this code in the Makefile: CC=gcc CFLAGS=-Wall main: main.o hello_fn.o clean: rm -f main main.o hello_fn.o The book says this should create two object files named main.o and hello_fn.o plus an executable named main. But the last is not created! Does it have to do with make version? or is the book outdated (2005) http://www.network-theory.co.uk/gcc/intro/ or you can the section that I'm referring to here: http://www.network-theory.co.uk/docs/gccintro/gccintro_16.html By the way I can create the executable using gcc -Wall main.c hello_fn.c -o main so it's not a gcc problem I don't think.