void value not ignored as it ought to be

Jul 30, 2009 at 1:27pm
i am getting this error when compiling with g++

where can I find documentation on this? I've look all over google without luck.
Jul 30, 2009 at 4:09pm
It means a function is declared to return nothing (void) but you are assigning the return code to a variable.

eg,

1
2
3
4
5
6
7
void foo() {
   // do stuff
}

int main() {
   int x = foo();  // error, foo returns nothing
}

Aug 6, 2009 at 4:36pm
thanks. do you know where it look up to information? i dont know where the error message documentation is
Aug 6, 2009 at 5:29pm
Not off the top of my head. I'd start here:

http://gcc.gnu.org/onlinedocs/

(I have not looked in detail at the documentation to see if they have compiler error messages).
Topic archived. No new replies allowed.