Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2016 00:19:50 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Arnab Bhowmick <arnabbhowmick08@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: c compiling using clang
Message-ID:  <20160427001950.d5159057.freebsd@edvax.de>
In-Reply-To: <CADNZooNCtC5D4KfoL0S94vj=v%2BgqzLXsh_Ruj%2B-h0ZvpyboW%2BQ@mail.gmail.com>
References:  <CADNZooNCtC5D4KfoL0S94vj=v%2BgqzLXsh_Ruj%2B-h0ZvpyboW%2BQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160427001950.d5159057.freebsd>