From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 31 01:41:04 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D283FDF for ; Tue, 31 Dec 2013 01:41:04 +0000 (UTC) Received: from mail-oa0-x22b.google.com (mail-oa0-x22b.google.com [IPv6:2607:f8b0:4003:c02::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E3D151392 for ; Tue, 31 Dec 2013 01:41:03 +0000 (UTC) Received: by mail-oa0-f43.google.com with SMTP id i7so12646864oag.16 for ; Mon, 30 Dec 2013 17:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=r0tG/uoq+PV0iICYtGR9/EaFTL9TVBILoKhX/xvI9+U=; b=SHMamEQ2srSLtlW4PfBOJahaan5e1t2TeqmhlaqSjWD1XS/PC59O6OYAQ0GS2SM+Nj PdlHa7PWObYOCaGklt0CMJkp0M8KEk6itGTmAnGBfaJT7sWEOL3P608k3oZZFXUnROYK /x3T2qaMHwtdTlMbsqXt/OPGmt5oDH3pagiuozZUSpK6eX80/VGGYW0SOpNIEAtn0zf+ JPcgSWGaUYsZRuAa5uWJnH26xgTj/HKRd5Lt0RJMv2JQcrZMxQxiKYzNNdB+SsZ82uT1 3naz122CjylWZFr/WUfl4YFwuLkuBcfZEln1yFp0/XMKJHXmiPRCFVjSayY6zRi/1Qc0 t/Ng== MIME-Version: 1.0 X-Received: by 10.60.51.102 with SMTP id j6mr45403565oeo.6.1388454062712; Mon, 30 Dec 2013 17:41:02 -0800 (PST) Received: by 10.182.78.100 with HTTP; Mon, 30 Dec 2013 17:41:02 -0800 (PST) In-Reply-To: References: Date: Mon, 30 Dec 2013 20:41:02 -0500 Message-ID: Subject: Re: template example From: Joe Nosay To: FreeBSD Hackers Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2013 01:41:04 -0000 On Sun, Dec 29, 2013 at 8:31 PM, Joe Nosay wrote: > > > > On Sun, Dec 29, 2013 at 12:22 PM, Tim Kientzle wrote: > >> On Dec 29, 2013, at 9:11 AM, Joe Nosay wrote: >> >> > >> > On Sat, Dec 28, 2013 at 10:44 PM, Joe Nosay >> wrote: >> > >> > >> > >> > On Sat, Dec 28, 2013 at 3:52 AM, Tim Kientzle wrote= : >> > >> > On Dec 27, 2013, at 7:41 PM, Joe Nosay wrote: >> > >> > > The standard "Hello World!" doesn't seem to work. >> > >> > Which one? Share the program you=92re trying to compile and what err= ors >> you=92re seeing. >> > >> > Tim >> > >> > >> > >> > >> > Thanks @Alfred_Perlstein it worked with that example using clang >> -fsyntax-only h.cpp >> > >> > a.out is the file. >> >> Never post binaries to a mailing list. It's rather rude. >> > > My apologies. > >> >> >> > Trying a different approach with ::: >> > #include >> > >> > #include >> > >> > int >> > main(int Argc, char **Argv) >> > { >> > int rv; >> > >> > rv =3D system("echo 'ls /tmp' " && " echo blee bble blle "); >> > std::cout << "return status from system call is: " << rv << >> std::endl; >> > return (rv); >> > } >> > >> > >> > >> > The output comes before the blee and the blee is not printed. What I >> need is for the output to be listed - or the act >> > ion to be executed - along with the echo. This time, clang -E >> -fsyntax-only h.cpp was used with no a.out being created. What was the >> difference between Perlstein's script and mine? >> >> Why are you using -E option here? The -E option actually tells clang t= o >> not compile the program, which is why you got no a.out file. >> >> You should also probably not get into the habit of using 'clang' directl= y >> but instead use the standard 'cc' or 'c++' commands. These are just >> aliases for the default system compiler. You can find out what compiler >> that is by asking it: >> >> $ cc --version >> FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 >> >> >> As for your program above, the && is outside of the quotations, so it's >> not doing what you expect. >> >> Try this line instead: >> >> rv =3D system("echo 'ls /tmp' && echo blee bble blle"); >> >> This type of programming (mixing C++ and shell) can get very confusing. >> >> Tim >> >> > I've looked at C and C++ and have decided that I should learn C first. I'm very limited on money, so a book isn't going to do it. Does anyone have any suggestions as to a decent to good website for working tutorials. Nothing seems to include int main as with previous examples and that seems to work somewhat. I've come up against code e.g. toybox, traverso, etc which I would like to port to FreeBSD but the errors are such as:: "./kconfig/lxdialog/dialog.h:32:10: error: expected "FILENAME" or #include CURSES_LOC ^ ./kconfig/lxdialog/dialog.h:97:2: error: unknown type name 'chtype' chtype atr; /* Color attribute */ ^ ./kconfig/lxdialog/dialog.h:187:16: error: unknown type name 'WINDOW' int on_key_esc(WINDOW *win); ^ " and such. I'm viewing C as having much more sanity than C++. Apologies for the noise and thanks muchly to anyone who reads this.