Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411594 Posts in 69386 Topics- by 58444 Members - Latest Member: FightingFoxGame

May 07, 2024, 12:37:21 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)XCode port of VS project, "no matching function"
Pages: [1]
Print
Author Topic: XCode port of VS project, "no matching function"  (Read 2181 times)
SelfTitled
Level 1
*



View Profile WWW
« on: August 03, 2010, 03:12:31 AM »

Hi

I'm getting an error when trying to compile code in XCode:
"No matching function for call to 'caspian::World:IntersectionTest(caspian::Vector2&, float*, <unnamed>::entity_output&)'"

this function I am attempting to call is declared like so:
Code:
			
class World : public CodeSection
{
public:
        template <typename OutputIterator>
void IntersectionTest(const Vector2& screen, float accuracy, OutputIterator iter) const
{
// do something
}
};

and called from code like the following:

Code:
WorldManager::GetCurrentWorld()->IntersectionTest(point, accuracy, entity_outputted(found, entity));

"entity_outputted" is a struct defined in the same file that the function call is made, but in an anonymous namespace.

I can compile and run the code fine in VS but not in xcode.

Any idea what the problem is and how it may be resolved?

Thanks

EDIT:
A little more code

Code:
namespace
{
struct entity_outputted
{
entity_outputted(bool& found, caspian::Entity* entity)
: found_ (&found)
, entity_(entity)
{
}

entity_outputted& operator*()     { return *this; }
entity_outputted& operator++()    { return *this; }
entity_outputted& operator++(int) { return *this; }

void operator=(const caspian::intersection_result& result)
{
if (result.entity_ == entity_)
*found_ = true;
}

private:
bool*            found_;
caspian::Entity* entity_;
};
}

namespace caspian
{
void IsEntityUnderPoint(CScriptProcessor* processor)
{
int     entity_id = processor->GetStackInt    (-2);
Vector2 point     = processor->GetStackVector2(-1);
float   accuracy  = processor->GetStackFloat  (0);
CSCRIPTPROCESSOR_HALTCHECK

Entity* entity = ResourceManager::Get()->GetResource<Entity>(entity_id);
CSCRIPTENTITY_EXISTCHECK(entity, entity_id)

bool found = false;
WorldManager::GetCurrentWorld()->IntersectionTest(point, accuracy, entity_outputted(found, entity));

processor->GetFunctionReturnVariable()->SetValue(Variable::INT_TYPE, found);
}
}
« Last Edit: August 03, 2010, 05:02:21 AM by SelfTitled » Logged

Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #1 on: August 03, 2010, 04:39:56 AM »

I can probably help you, but I need to see more code than that.
Logged



What would John Carmack do?
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #2 on: August 03, 2010, 05:41:02 AM »

I don't see anything wrong offhand, but without being able to compile it, it's tough to say.  I did notice this:

The error message says the first parameter is a caspian::Vector2&, but the function takes a const caspian::Vector2&.  Is that a typo in your post?

Also, what namespace is the World class in?
Logged



What would John Carmack do?
SelfTitled
Level 1
*



View Profile WWW
« Reply #3 on: August 03, 2010, 07:26:48 AM »

That was the error I got, if I remove the const from the parameter I get the same error.

The World class is in the caspian namespace.

Thanks
Logged

Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #4 on: August 03, 2010, 07:39:10 AM »

The only thing I can think of is that you missed an #include somewhere, and the compiler hasn't seen the definition of World at the point where you are calling the function.  That would explain why it's getting the signature wrong.
Logged



What would John Carmack do?
OneSadCookie
Level 0
**



View Profile
« Reply #5 on: August 03, 2010, 08:28:00 AM »

Two things strike me here:

1) in your error message it says you're passing a float* for parameter two, but at the call site it looks to be clearly a float.  Did you typo the error message?

2) in your error message it says you're passing an entity_output& for parameter three, but your class is called entity_outputted.  Did you just rename the class between your first post and your second?
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #6 on: August 03, 2010, 11:18:11 AM »

Average - you should be ashamed to be beaten by a man-baby like that.  Tongue
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #7 on: August 03, 2010, 12:00:14 PM »

Average - you should be ashamed to be beaten by a man-baby like that.  Tongue

If that's the OneSadCookie I think it is, he's an established authority on Mac game programming.  No shame whatsoever.
Logged



What would John Carmack do?
SelfTitled
Level 1
*



View Profile WWW
« Reply #8 on: August 04, 2010, 01:03:16 AM »

Thanks guys, I had made a mistake typing the error out.

The problem was that (as OneSadCookie suggested) I was passing a float* for the second parameter when a float was expected. It seems that a change had be made to the codebase between VS build and the xcode build which is why it built on VS still.

Thanks very much for all your help.
« Last Edit: August 04, 2010, 01:09:26 AM by SelfTitled » Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic