Results 1 to 4 of 4

Thread: Strange Compilation issue

  1. #1
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Strange Compilation issue

    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:
    Qt Code:
    1. /Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:34: error: variable or field 'setUser' declared void
    2. /Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:34: error: 'int CandidateManager::setUser' is not a static member of 'class CandidateManager'
    3. /Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:34: error: 'passedUser' was not declared in this scope
    4. /Users/nicholassmith/Development/CAMSv5/CandidateManager/candidatemanager.cpp:35: error: expected ',' or ';' before '{' token
    To copy to clipboard, switch view to plain text mode 

    When compiling this:

    Qt Code:
    1. //From .cpp
    2. void CandidateManager::setUser(passedUser)
    3. {
    4. consultant = passedUser;
    5. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //From .h
    2. void setUser(QString );
    To copy to clipboard, switch view to plain text mode 

    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!

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Strange Compilation issue

    Quote Originally Posted by NicholasSmith View Post
    Qt Code:
    1. void CandidateManager::setUser(passedUser)
    2. {
    3. consultant = passedUser;
    4. }
    To copy to clipboard, switch view to plain text mode 
    The problem is you forgot to specify data type in function definition.
    Use this:
    Qt Code:
    1. void CandidateManager::setUser(QString passedUser)
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Strange Compilation issue

    Damn, spot on thank you!

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

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Strange Compilation issue

    Quote Originally Posted by NicholasSmith View Post
    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.

Similar Threads

  1. Debug issue (Qdialog)
    By td in forum Newbie
    Replies: 1
    Last Post: 2nd June 2009, 15:07
  2. Strange File Path Issue
    By tpf80 in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2008, 07:48
  3. Very strange socket programming problem
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2008, 13:05
  4. Strange behavior with Drag and Drop (not always drops)
    By Mona Shokrof in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2007, 19:00
  5. strange error in compilation
    By quickNitin in forum Newbie
    Replies: 9
    Last Post: 30th August 2006, 13:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.