PDA

View Full Version : Strange Compilation issue



NicholasSmith
4th September 2009, 14:14
Hi guys, I've been chewing over this for far too long now and can't spot why it's not working.

I'm getting this error:

/Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:34: error: variable or field 'setUser' declared void
/Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:34: error: 'int CandidateManager::setUser' is not a static member of 'class CandidateManager'
/Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:34: error: 'passedUser' was not declared in this scope
/Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:35: error: expected ',' or ';' before '{' token

When compiling this:



//From .cpp
void CandidateManager::setUser(passedUser)
{
consultant = passedUser;
}




//From .h
void setUser(QString );


I'd post the full application code but it's close to 1k lines long, but that's the section that seems to be throwing an issue. I've been through deleting all project files and starting again, commenting out the entirety of the application aside from that one function etc.

Strange thing is, it works fine in another application I've written. I've literally run out of ideas, can anyone think of something I may have missed?

Thanks for any help!

yogeshgokul
4th September 2009, 14:24
void CandidateManager::setUser(passedUser)
{
consultant = passedUser;
}
The problem is you forgot to specify data type in function definition.
Use this:

void CandidateManager::setUser(QString passedUser)

NicholasSmith
4th September 2009, 14:36
Damn, spot on thank you!

You wouldn't think I'd been doing C++ for close to 5 years making mistakes like that!

yogeshgokul
4th September 2009, 14:40
Damn, spot on thank you!
You wouldn't think I'd been doing C++ for close to 5 years making mistakes like that!
I m too lazy to think. ;)