variable or field declared void


Question

I have a function called:

void initializeJSP(string Experiment)

And in my MyJSP.h file I have:

2: void initializeJSP(string Experiment);

And when I compile I get this error:

MyJSP.h:2 error: variable or field initializeJSP declared void

Where is the problem?

1
45
9/26/2011 6:35:57 AM

Accepted Answer

It for example happens in this case here:

void initializeJSP(unknownType Experiment);

Try using std::string instead of just string (and include the <string> header). C++ Standard library classes are within the namespace std::.

72
12/12/2008 9:36:22 PM

This is not actually a problem with the function being "void", but a problem with the function parameters. I think it's just g++ giving an unhelpful error message.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon