Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hellow, I am upgrading a game engine, but I get errors
I dont know how to fix it

Error Code:
'
1>------ Build started: Project: hl, Configuration: Debug Win32 ------
1> gonome.cpp
1>d:\src_dll\dlls\gonome.cpp(115): error C3867: 'CGonomeSpit::Animate': function call missing argument list; use '&CGonomeSpit::Animate' to create a pointer to member
1>d:\src_dll\dlls\gonome.cpp(164): error C3867: 'CBaseEntity::SUB_Remove': function call missing argument list; use '&CBaseEntity::SUB_Remove' to create a pointer to member

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
'

Source Code:

C#
void CGonomeSpit::Animate( void )
{
    pev->nextthink = gpGlobals->time + 0.1;

    if ( pev->frame++ )
    {
        if ( pev->frame > m_maxFrame )
        {
            pev->frame = 0;
        }
    }
}



//=========================================================
// Gonome's spit projectile
//=========================================================
class CGonomeSpit : public CBaseEntity
{
public:
	void Spawn( void );

	static void Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity );
	void Touch( CBaseEntity *pOther );
	void EXPORT Animate( void );

	virtual int		Save( CSave &save );
	virtual int		Restore( CRestore &restore );
	static	TYPEDESCRIPTION m_SaveData[];

	int  m_maxFrame;
};



I have no idea to fix the code

Please help me
Posted
Updated 17-Oct-21 19:59pm

You might also have somthing wrong before that like a missing } which would cause the compiler to try to compile the code as if it was inside a function.
 
Share this answer
 
There is a little difference between the older compiler and the newer:
void mycallback()
{
}
void worker(void (*fn)())
{
  (*fn)();
}
void main()
{
  // accepted only by devstudio 6 and lower
  worker(mycallback); // old compiler makes an implicit cast to a function call
  // function parameter for new devstudio
  worker(&mycallback); // new compiler needs an explicit cast to a function call
}

Regards.
 
Share this answer
 
Comments
sora97 15-Aug-11 2:16am    
I am using microsoft visual c++ 2010 express
mbue 15-Aug-11 2:31am    
fine. i resume:

// old compiler
class A
{
public:
void Do(){}
void worker(void (A::*fn)())
{
(this->*fn)();
}
};

void main()
{
A a;
a.worker(A::Do);
}


// new compiler
void main()
{
A a;
a.worker(&A::Do);
}

You only have to add '&' before the function name as parameter.
Regards.
sora97 15-Aug-11 2:58am    
SetThink ( SUB_Remove ); //added &
but error code:
1>------ Build started: Project: hs, Configuration: Debug Win32 ------
1> gonome.cpp
1>d:\src_dll\dlls\gonome.cpp(164): error C3867: 'CBaseEntity::SUB_Remove': function call missing argument list; use '&CBaseEntity::SUB_Remove' to create a pointer to member
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
mbue 15-Aug-11 4:46am    

SetThink ( &CBaseEntity::SUB_Remove );
Sergey Alexandrovich Kryukov 15-Aug-11 23:41pm    
My 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900