C++之‘malloc’ was not declared in this scope和invalid conversion from ‘void*’ to ‘char*’
生活随笔
收集整理的這篇文章主要介紹了
C++之‘malloc’ was not declared in this scope和invalid conversion from ‘void*’ to ‘char*’
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、錯誤一
?
‘malloc’ was not declared in this scope?
?
?
2解決
?加上頭文件文件<stdlib.h>
?
3、錯誤二
?
invalid conversion from ‘void*’ to ‘char*’?
?
?
?
?
4、解決
在malloc函數前面加上強轉類型(char *)
總結
以上是生活随笔為你收集整理的C++之‘malloc’ was not declared in this scope和invalid conversion from ‘void*’ to ‘char*’的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: unix网络编程之UNIX Domain
- 下一篇: C++之explicit关键字使用总结