From owner-freebsd-questions@freebsd.org Tue Apr 26 22:19:53 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE28FB1CC6E for ; Tue, 26 Apr 2016 22:19:53 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 926B01713 for ; Tue, 26 Apr 2016 22:19:53 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-216-66.dynamic.qsc.de [92.195.216.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 12CF424C42; Wed, 27 Apr 2016 00:19:51 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u3QMJop4002065; Wed, 27 Apr 2016 00:19:50 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 27 Apr 2016 00:19:50 +0200 From: Polytropon To: Arnab Bhowmick Cc: freebsd-questions@freebsd.org Subject: Re: c compiling using clang Message-Id: <20160427001950.d5159057.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 22:19:53 -0000 On Tue, 26 Apr 2016 22:19:40 +0530, Arnab Bhowmick wrote: > I am new to Freebsd. I want to practice c programming for my college > projects. I have wrote some program but when i am trying to compile the > program by using > % cc filename.c its showing % not found. That's the correct and expected behaviour, as the "%" character is not part of the command you should enter. It's the shell's prompt character shown to illustrate that the command should be entered from a user account (in opposite to the root account where "#" is used). You will see this way of "implicit documentation" in many places. > I went through the handbook but > did not understand the process. Previously i have used clang compiler on > Ununtu but i think that it is a little bit tricky to compile c under > freebsd. It's the same, except on Ubuntu you'll probably see a "$" infront of command line examples. > Can anyone say how to resolve this? Do not enter the "%" character, just the command. To illustrate: % cc filename.c % ./a.out or % cc -o myprog filename.c % ./myprog Note that the "./" is needed infront of the program name you just compiled because the current working directory usually is not in $PATH, so the shell will not execute programs from that location unless explicitely specified. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...