For a string problem, I tried to use getdelim function and I get this warning :
warning: implicit declaration of function ‘getdelim’
I guess it's a library problem although I have tried to include some of them.
Any suggestion?
For a string problem, I tried to use getdelim function and I get this warning :
warning: implicit declaration of function ‘getdelim’
I guess it's a library problem although I have tried to include some of them.
Any suggestion?
I've never heard of it. You need to find out what header file to include, and what, if any, linker files (.dll, .so, .lib, etc) are needed to access the function.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
You need to define _GNU_SOURCE before including stdio.h. Generally this is done on the commandline, as in "cc -D_GNU_SOURCE", but you could also do it at the very top of your source file.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
This is just a simple code that i tried the use of getdelim.Code:#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> int main() { int bytes_read; int nbytes = 100; char *my_string; puts ("Please enter a line of text."); /* These 2 lines are the heart of the program. */ my_string = (char *) malloc (nbytes + 1); bytes_read = getdelim (&my_string, &nbytes,'\n', stdin); if (bytes_read == -1) { puts ("ERROR!"); } else { puts ("You typed:"); puts (my_string); } return 0; }
Parameter 2 in getdelim is a pointer to size_t, so your nbytes should be of the type size_t (note that int and size_t may be different size as well as different sign - and if it's different size you'd get more problems even if you use unsigned int and the compiler doesn't give this particular warning [it probably will give some other warning tho']).
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.