C2064: term does not evaluate to a function taking 0 arguments

Top  Previous  Next

If you get this error:

 

1>c:\...\sources\book\testfunctions.cpp(51): error C2064: term does not evaluate to a function taking 0 arguments

 

...it could well be that you are calling, for example, a member variable as if it is a function:

 

   VARIANT_BOOL bIs = piPartCompDef->IsiPartFactory () ;

 

In other words you have used brackets () where they are not required. You should write this:

 

   VARIANT_BOOL bIs = piPartCompDef->IsiPartFactory ;

 

Another example would be the oft used Count. The following is an error because Count is not a function:

 

       long iNumAssets = pAssEnum->Count() ;

 

Count is a member variable, this is the correct way of accessing it:

 

       long iNumAssets = pAssEnum->Count ;

 

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)