Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jul 2018 14:19:47 +0930
From:      Shane Ambler <FreeBSD@ShaneWare.Biz>
To:        Antonio Olivares <olivares14031@gmail.com>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Clang++ stdlib/cstdlib.h workaround
Message-ID:  <f907f846-f607-40a1-c925-c04d1569ac47@ShaneWare.Biz>
In-Reply-To: <CAJ5UdcP-Hpa%2BYqAkwkrv4ec_mV=CaTzDo%2BkCAADd-JKb25OdeQ@mail.gmail.com>
References:  <CAJ5UdcP-Hpa%2BYqAkwkrv4ec_mV=CaTzDo%2BkCAADd-JKb25OdeQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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<path> as an argument that tells clang where to search for
header files. -L<path> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f907f846-f607-40a1-c925-c04d1569ac47>