我正在尝试用 g++ 编译一些 c 代码(是的,故意的)。我收到如下错误(例如):
error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]
添加-fpermissive
到编译选项让我:
error: invalid conversion from 'void*' to 'unsigned char*' [-Werror=permissive]
由于 ,这似乎是一个错误-Werror
,但是添加-Wno-error=permissive -Wno-permissive
会导致:
error: -Werror=permissive: no option -Wpermissive
error: unrecognized command line option "-Wno-permissive" [-Werror]
如何禁用从 void* 转换为其他指针类型的警告(全局)?