• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

error installing software


While installing some software i got this error

Fasta.cpp: In member function ‘std::string FastaReference::getSequence(std::string)’:
Fasta.cpp:266: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
Fasta.cpp: In member function ‘std::string FastaReference::getSubSequence(std::string, int, int)’:
Fasta.cpp:308: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result

I was advised to 'Try to include #include <cstring>' however i don't know what that means as i don't program in C++ how i would i go about doing it.

Any advice much appreciated

[corrected zone from C# to C++ - mrjoltcola / Zone Advisor]
1 Solution
There are no errors, just warnings.

When you use fread, the program should check the return values.

Return Value
"The total number of elements successfully read is returned as a size_t object, which is an integral data type."
"If this number differs from the count parameter, either an error occured or the End Of File was reached."
"You can use either ferror or feof to check whether an error happened or the End-of-File was reached."


If you have want to modify the code, I can help you modify it to remove the warning.
Edit Fasta.cpp file

At the top of the file, along with other include statements, just include


Also, please show the file

cat Fasta.cpp
Could please provide
- What software you try to install
- Which Linux do you have (Ubuntu, Fedora, CentOS/RedHat) and the version?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

If you have no errors, but only warnings, then your program should build OK and run.

The warning means that there could have been extra error checking on the reading of a file. Since, most of the time, fread does not return an error (once the software is working well and the file is properly opened with error checking to prevent reading from, say, a non-existent file), then the program should work OK.

But good programming practices dictates that every C/C++ library call that returns an error condition should be checked for an error.
Just add a return variable for fread so it is not ignored and the compiler will be happy.
Just find the locations of the fread calls and change



size_t ret;
ret = fread();
andiejeAuthor Commented:
hello phoffric my old friend. is there anything you don't do???

Fasta.cpp is too long to show.

I've already installed the software (by the commands make clean and make all). If the warning is harmless and the program will run ok i will leave it. It seems to be ok but i don't know enough to know if it is ok behind the scenes
hello andieje my old friend. I don't do lots of anything, LOL.

Have you abandoned the teaching idea?

If your program seems to work, then great. If it stops working someday, the library call return status (if present) certainly help in analyzing the problem. If a file exist, but still gives problems, it could even be a permissions problem that you may have realized. But if proper error handling were in place, then an application error message would be displayed for you to remedy the problem.
andiejeAuthor Commented:
i had to put the teaching on hold for a year due to family problems but everything has changed in this country wrt teaching - huge cuts and no jobs so don't know what i will do. Luckily i have some brains (though not as many as you) so retraining is not an issue (though i may have to turn my back on the astrophysics world)
huge cuts in teaching here also. my son had signed up to begin a masters in education when he just heard of the huge cuts and cancelled registration.

no more brains than you. just focussed on different things. you can walk spheres around me in the IT world.
andiejeAuthor Commented:
says the man solving my IT question :)

The one thing I found i've enjoyed most in my career is creating resources for teaching as I like the creativity of finding analogies and models to explain concepts. I might do the teacher training to give me the credibility i need to get into writing educational resources.

I have not found research to be that fulfilling. It is just politics and egos and very very slow. It's not the band of altruists working towards a common goal and the good of mankind that i hoped. It's just a game of knocking out as many papers as you can as quickly as you can
>> It's not the band of altruists working towards a common goal and the good of mankind
Long time ago, I saw 3 Nobel Prize Winners (at least 2 in physics) being interviewed. Eventually, it came around to why they did the work they did - was it (something along the lines about what you just mentioned). I was really surprised to hear them say that the hard work and study was for the "prize" and the "recognition" that they were great. And here I thought it was for their love of knowledge.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now