Jump to content
  • Advertisement
Sign in to follow this  
Fooley

Help me!!!!

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm learning to program using Blocks but the book I'm learning from tells me to put: //register the class MyRegisterClass(hInstance); and when I try to build it tells me that It is undeclared and that I need to use some function Help!!!!

Share this post


Link to post
Share on other sites
Advertisement
Hey, ya know, start 9 or 10 user accounts and ask the same question. And when you get an answer, ask again anyway under a different name.

That's ridiculous, dude.

Share this post


Link to post
Share on other sites
MyRegisterClass() is not a function of the WinAPI. You have to write it. If you wrote it and you code looks like this one:

func1()
{
// here, I use MyRegisterClass()
if (!MyRegisterClass(hinstance)) { // error: MyRegisterClass is undeclared
...
}
}

bool MyRegisterClass(HINSTANCE hinstance) // MyRegisterClass definition
{
}


Then you broke one of the basic rule of C++ which is: I can't use something that hasn't been declared yet. Put the declaration of MyRegisterClass() at the top of your file and it should run:
bool MyRegisterClass(HINSTANCE hinstance); // MyRegisterClass declaration

func1()
{
// here, I use MyRegisterClass()
if (!MyRegisterClass(hinstance)) { // MyRegisterClass is declared
...
}
}

bool MyRegisterClass(HINSTANCE hinstance) // MyRegisterClass definition
{
}

HTH

Share this post


Link to post
Share on other sites
If so, then he already asked. Why ask again?

The anonymous poster in Chip Holder's thread is me. Another poster and I answered your question there.

[addendum] And thank you, Emmanuel, for explaining it in code for them. Apologies that I didn't do it, myself.

Share this post


Link to post
Share on other sites
Chip holder put the code you said on the top, and it said

ISO C++ forbids declaration of 'func1' with no type

what does that mean??

Share this post


Link to post
Share on other sites
I put in MyRegisterClass in the parantheses at the top and it says:

expected constructor, destructor, or type conversion before '(' token

can you explain please?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well, that's just an example. Try 'void func1()' if you want.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
we r going t try it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!