error: variable 'std::ifstream ifs' has initializer but incomplete type


main.cpp: In function 'bool ReadTimeInterval(std::string&)':
main.cpp:134: error: variable 'std::ifstream ifs' has initializer but incomplete type
main.cpp:139: warning: deprecated conversion from string constant to 'char*'
main.cpp:139: warning: cannot pass objects of non-POD type 'const struct std::string' through '...'; call will abort at runtime

出现这个错误,是由于没有添加头文件:

添加 #include <fstream>

总结:这里看到了gcc的提示,incomlete type不完全的类型。

一般这种题目是因为缺乏头文件引起的,经常会碰到如许子的提示,所以记住产生incomplete type的原因。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM