User forums > General (but related to Code::Blocks)

Cannot evaluate function -- may be inlined

<< < (3/8) > >>

oBFusCATed:
Every decent program has a manual or search the internet. It is not that hard.

zabzonk:
@smallB:

I don't know what you are doing in the debugger, but this code (I had to make changes to get it to compile and link), is debuggable using gdb and CB for me:


--- Code: ---#include <string>

template <class Forward_Iterator>
bool is_operator_( Forward_Iterator it ) {
return * it == '+';
}

template<class Forward_Iterator>
std::string  get_operator_( Forward_Iterator beg, Forward_Iterator end) {
return "+";
}

template<class Forward_Iterator>
std::string  get_term_( Forward_Iterator beg, Forward_Iterator end) {
return "term";
}

template<class Forward_Iterator>
    std::string read_next_token_(Forward_Iterator beg,Forward_Iterator end)
    {
        std::string result;
        if (std::isdigit(*beg))
        {
            return get_term_(beg,end);
        }
        else if (is_operator_(beg))
        {
            return get_operator_(beg,end);
        }
else {
throw "error";
}
    }


int main(int argc, char* argv[])
{
std::string foo = "1234567avavav";
std::string t = read_next_token_( foo.begin(), foo.end() );
}

--- End code ---

smallB:
@Neil, perhaps I'm doing something wrong.
this code:

--- Code: ---#include <string>


    int main(int argc, char* argv[])
{
std::string foo = "1234567avavav";
return 0;
}
--- End code ---
gives following output:
http://imageshack.us/photo/my-images/259/cannotevaluate.png/

MortenMacFly:

--- Quote from: smallB on November 06, 2011, 02:38:23 pm ---gives following output:

--- End quote ---
Here, the compiler might simply has optimised out the std::string as it is not being used. Make sure it's being used (i.e. output it on the console) and try again.

Furthermore: This is actually not a C::B issue. To differ between a C::B and a GDB issue, try to debug at the command line. If it shows the same result, then it's basically "your fault" as C::b is just an interface to GDB.

zabzonk:
@smallB:

See http://imgur.com/Uqajo

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version