C++ 错误:没有值的返回语句,在函数中返回“void*”[-fpermissive]

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18024406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 21:39:58  来源:igfitidea点击:

error: return-statement with no value, in function returning ‘void*’ [-fpermissive]

c++compilation

提问by user2529727

When trying to "make" a file I keep getting the following error:

尝试“制作”文件时,我不断收到以下错误:

 error: return-statement with no value, in function returning ‘void*' [-fpermissive]

I can show the code to people who would like to see, but I would rather send it over a message.

我可以向想看的人展示代码,但我更愿意通过消息发送。

I've searched some and some people suggest it's a compiling error that is common in "newer" compilers... and yes, I updated mine yesterday. Horrid idea.

我搜索了一些,有些人认为这是“较新”编译器中常见的编译错误……是的,我昨天更新了我的。可怕的想法。

回答by pippin1289

The error means that in your function:

该错误意味着在您的函数中:

void* foo(...);

You have a statement:

你有一个声明:

return;

But the compiler expects a value to be provided:

但是编译器希望提供一个值:

return myVoidPtr;