Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / how to use agk::print with cpp method (tier2)? currently getting error "non-standard syntax; use '&' to create a pointer to member"

Author
Message
salkawari
7
Years of Service
User Offline
Joined: 12th Apr 2017
Location:
Posted: 3rd May 2017 00:03
hi, i want to get the text for a print statement from a separate class.

i want to get the text from my class MyClass, from the method getHelloWorld. you can find all the code in the attached zip. here is the most relevant few lines...


MyClass myClass;

int app::Loop (void)
{
agk:rint( agk::ScreenFPS() );
agk:rint( myClass.getHelloWorld );
agk::Sync();

return 0;
}

when i compile this i see the following error message:
1>template.cpp(27): error C3867: 'MyClass::getHelloWorld': non-standard syntax; use '&' to create a pointer to member

how can i fix this?

Thanks,

Sal

PS: if you're wondering why i want to do this, its because i want to put some of my logic into other classes / cpp files rather than having 1 really big template.cpp file.
salkawari
7
Years of Service
User Offline
Joined: 12th Apr 2017
Location:
Posted: 3rd May 2017 22:05
ok, i worked out there were some problems with the code above:
1. the object wasnt correctly instantiated over a constructor.
2. the definition of the method getHelloWorld missed the classname -> "MyClass::"

Login to post a reply

Server time is: 2024-11-22 15:18:24
Your offset time is: 2024-11-22 15:18:24