简体   繁体   中英

fread error when running a c++ project from github

I tried to run the makefile on https://github.com/nasadi/Zambezi . It shows an error like:-- "file included from src/driver/buildContiguous.c:7:0: src/shared/dictionary/Dictionary.h: In function 'readDictionary': src/shared/dictionary/Dictionary.h:132:8: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] fread(&id, sizeof(int), 1, fp);" . Can anyone help me to run the program.Do i need to install any packages.I am new to c programming.

In fact, this is not an error, it is a warning. When compiler emits a warning, it means that code is syntactically correct but may potentially contain logic error. In your case compiler says that return value of the fread function is not examined. Such ignorance can lead to a situation, where, for eg, end of file is encountered, but the program is unaware of it and continues execution. Therefore, variable read from file have wrong value, and wrong (invalid) values may cause program crash later on.

Summarizing, if there are no other errors , then your program is successfully compiled and can be run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM