• 14
• 12
• 9
• 10
• 13

# Minor Define Problem

This topic is 2036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to allow my error reports to automatically include the file and line number using defines.

Like so:
 #define NPERROR( x ) EngineAPI()->Error( __FILE__, __LINE__, x ); 

Which calls this method:
 void Error( const char* file, uintn line, const char* format, ... ); 

I'm trying to use the define macro like so:
 NPERROR( "Chicken named '%s' ate the game code!", chickenName ) 

However this causes issues because it expects only one parameter in the define and it interprets the commas as new parameters!
How do you think I can fix this while hopefully still including the file and line number automatically?

Thanks as usual!

 #define NPERROR(...) EngineAPI()->Error( __FILE__, __LINE__, __VA_ARGS__ );