need compiler for c++ function like "drand48(), abort() .."

Jan 26, 2016 at 9:13pm
hi,
i am beginner in programming and i have compilation errors when i compile lines that containes fuctions like "drand48(), abort()....etc", the compiler that i use is gcc that come with codeblocks on windows. i think that i must use another compiler?
could any one give me solution.
best regards
Jan 26, 2016 at 9:39pm
closed account (E0p9LyTq)
For abort() just include the <cstdlib> (C++ code) or <stdlib.h> (C) header.
http://www.cplusplus.com/reference/cstdlib/abort/

Change the drand48() call to rand(). drand48() is a Linux compiler function that is non-standard.
http://stackoverflow.com/questions/11065861/drand48-on-windows#11068161
Jan 26, 2016 at 10:02pm
your reply is so helpful i understand now thank you so much
Jan 26, 2016 at 11:36pm
closed account (E0p9LyTq)
If you really want good C++ random number generation then avoid the C library functions. With C++11 use the <random> header and one of the generator engines instead.
http://www.cplusplus.com/reference/random/
Jan 28, 2016 at 10:43pm
thank u again i will see it
Last edited on Jan 28, 2016 at 10:43pm
Topic archived. No new replies allowed.