CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    26

    error C2664 : cannot convert parameter from WORD' to 'WORD' 2 from

    I am trying to transmit by reference a Struct type parameter, but i get the following error:

    error C2664 : cannot convert parameter 2 from 'TextFrameworkEngine::WORD' to 'WORD'

    My code is quite simple :

    test.h

    Code:
    struct WORD {
    string text;
    }
    test.cpp

    Code:
    bool findWord(WORD &findWord){
    
    // if the word is found in the current text, fill the findWord fields
    return true;
    }
    
    void findAll() {
    
    WORD findworld;
    findWord(findword);
    }
    I know it's a conversion type problem, but i do not manage to solve it. Do you have some suggestions?

    Best wishes,
    D.M.
    Last edited by munteanu24d; September 9th, 2009 at 05:53 AM.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: error C2664 : cannot convert parameter from WORD' to 'WORD' 2 from

    Looks like there's another type named WORD out there somewhere. Try another name.

  3. #3
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: error C2664 : cannot convert parameter from WORD' to 'WORD' 2 from

    or use your own namespace to define the WORD in.

  4. #4
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: error C2664 : cannot convert parameter from WORD' to 'WORD' 2 from

    If you're using Windows, there is already a typedef called WORD, along with BYTE & DWORD.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured