From owner-freebsd-questions@freebsd.org Wed Jul 4 04:50:00 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E50D0102E848 for ; Wed, 4 Jul 2018 04:49:59 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [150.101.137.133]) by mx1.freebsd.org (Postfix) with ESMTP id 2AE0B85A39 for ; Wed, 4 Jul 2018 04:49:58 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ppp118-210-20-47.bras1.adl4.internode.on.net (HELO leader.local) ([118.210.20.47]) by ipmail01.adl2.internode.on.net with ESMTP; 04 Jul 2018 14:19:49 +0930 Subject: Re: Clang++ stdlib/cstdlib.h workaround To: Antonio Olivares , FreeBSD Questions References: From: Shane Ambler Message-ID: Date: Wed, 4 Jul 2018 14:19:47 +0930 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 04:50:00 -0000 On 04/07/2018 04:08, Antonio Olivares wrote: > Dear kind folks, > > I have a cpp file that used stdlib.h and it compiled and ran successfully. > I am trying it out with clang and it returns errors that it cannot find > stdlib.h, I remove the stdlib.h include statement and it still complains. You can add -I as an argument that tells clang where to search for header files. -L does the same for libraries. Even when you remove it another included file may still want it. clang++ -I/usr/include -L/usr/lib -o myapp myfile.cpp > I made a copy of the c++ file and it compiles and runs correctly, but I > removed some stuff " --- " and only output the numbers. How do I deal with > stdlib.h requirements? > > The program finds numbers that are triangular and square. It fails for > numbers that are bigger than 2147483647. Does that number have any significance to you? It is the largest number that can be held by a 32bit signed integer. You can use an unsigned int to get twice that or you can use a long long to get a 64bit integer. Also related is that the math library functions have several variations that take different size arguments. -- FreeBSD - the place to B...Software Developing Shane Ambler