Reputation: 331
I've compiled a .cpp file with g++ and the only errors I had were like this:
histogram.cpp:24:26: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
fread(&altura,4,1,fp);
^
I know I'm using a very restrictive flags which treat warnings as errors, but trying to fix this errors I failed, so if someone can bring some light in this problem I'll be very pleased. The flags I'm using are:
g++ -std=c++11 -Wall -Werror -O3 histogram.cpp -o histogram
Thank you.
Upvotes: 1
Views: 1908
Reputation: 13984
I guess you don't use the return value of "fread", you need something like this:
size_t result = fread (buffer, 1, lSize, pFile);
if (result > 0)
// do smthng
instead of
fread (buffer,1,lSize,pFile);
Upvotes: 3