CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2005
    Posts
    19

    Question error C2064: term does not evaluate to a function

    Hi...everyone...i got this error when i build my project....(error C2064: term does not evaluate to a function) and it points to this part of my code:

    sMsg = "Delete " + Str(selected) + " selected item(s)?";

    Thanks.

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725

    Re: error C2064: term does not evaluate to a function

    It is probably the ... Str(selected) ... term.

    Is Str() a function ? some type of string variable ?

  3. #3
    Join Date
    May 2005
    Location
    United States
    Posts
    526

    Re: error C2064: term does not evaluate to a function

    Str() is a function that converts a numeric type to a string, but in Visual Basic, not C++. If you want to put different types together into a std::string in C++, one easy way is to use a stringstream, like so:
    Code:
    #include <iostream>
    #include <sstream>
    using namespace std;
    
    int main()
    {
        int selected = 4;
        ostringstream MessageStream;
        string Message;
    
        MessageStream << "Delete " << selected << " selected item(s)?";
        Message = MessageStream.str();
        
        cout << Message << endl;     // OUTPUT: Delete 4 selected item(s)?
    
        return 0;
    }

  4. #4
    Join Date
    Oct 2005
    Posts
    19

    Question Re: error C2064: term does not evaluate to a function

    Quote Originally Posted by Philip Nicoletti
    It is probably the ... Str(selected) ... term.

    Is Str() a function ? some type of string variable ?


    yes it is a function....what muist be the problem???help!!!!!!

  5. #5
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: error C2064: term does not evaluate to a function

    See the code provided by Smasher/Devourer's. It has the solution that you are seeking.

  6. #6
    Join Date
    Oct 2005
    Posts
    19

    Talking Re: error C2064: term does not evaluate to a function

    Thanks...you are all heaven's sent!

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