Clang++ stdlib/cstdlib.h workaround
FreeBSD at ShaneWare.Biz
Wed Jul 4 04:50:00 UTC 2018
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
More information about the freebsd-questions