error installing software

Posted on 2011-05-11
Last Modified: 2012-05-11

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]
Question by:andieje
    LVL 31

    Expert Comment

    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.
    LVL 31

    Expert Comment

    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
    LVL 38

    Expert Comment

    Could please provide
    - What software you try to install
    - Which Linux do you have (Ubuntu, Fedora, CentOS/RedHat) and the version?
    LVL 31

    Accepted Solution

    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.
    LVL 40

    Expert Comment

    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();

    Author Comment

    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
    LVL 31

    Expert Comment

    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.

    Author Comment

    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)
    LVL 31

    Expert Comment

    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.

    Author Comment

    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
    LVL 31

    Expert Comment

    >> 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.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now