Game Development Community

Beginner Torque2D user - xcode build fail

by Elena Soltau · in Torque 2D Beginner · 05/01/2014 (9:59 am) · 5 replies

Hi,

Just set up my environment on both a MAC and Windows machine. I am unsure which one I want to use. My MAC is a bit rickety. The initial code I downloaded will build on my Windows machine using Visual Studios Express 2013, but not on the Mac. Not sure of the reason.

The error I am getting on the xcode workspace is in the behaviorComponent_ScriptBinding.h file on line 315. I am getting a Semantic Issue, Cannot initialize return object of type 'const char *' with an rvalue of type 'bool'. The line in question is in an if-statement and returns false.


Any thoughts?

thank you,
Elena

About the author

Recent Threads


#1
05/01/2014 (11:42 am)
What version of Xcode do you have?

I'm running 5.1.1 and it is not flagging that file as an issue - it's probably interpreting the false as a 0. For whatever reason your compiler version is interpreting the false as a string.

I suppose as a fix for your specific case you could replace line 315 with this:

return -1;
#2
05/01/2014 (12:30 pm)
Or
return "false";
// or perhaps 
return "";
so that it's still returning a char*....
#3
05/01/2014 (12:53 pm)
@Richard - that won't work. The ConsoleMethod in question is:

ConsoleMethodWithDocs( BehaviorComponent, getBehaviorConnectionCount, ConsoleInt, 4, 4, (outputBehavior, outputName))
{
    // Find output behavior.
    BehaviorInstance* pOutputBehavior = dynamic_cast<BehaviorInstance*>( Sim::findObject( argv[2] ) );

    // Did we find the behavior?
    if ( !pOutputBehavior )
    {
        // No, so warn.
        Con::warnf("BehaviorComponent::getBehaviorConnectionCount() - Could not find output behavior '%s'.", argv[2] );
        return false;
    }

    // Fetch output name.
    StringTableEntry pOutputName = StringTable->insert( argv[3] );

    // Return the connection count.
    return object->getBehaviorConnectionCount( pOutputBehavior, pOutputName );
}

It needs to return an int, not a string.
#4
05/01/2014 (3:25 pm)
Hi Mike,

Just installed Xcode 5.1.1 . So I am unsure why it is tagging the return. I'll try playing with the return value a bit to see if I can find a solution. I'll try some of the suggestions. I'll let you know how it works out.

E
#5
05/01/2014 (6:27 pm)
I decided I needed a fresh start. I reinstalled Xcode, but that did not work. I forked fresh code and downloaded it. Bingo! I must have corrupted the code when I was playing with github.

Thanks to all who responded.

E