Sign in to follow this  
Lucas W

type specifier - int assumed.

Recommended Posts

Hi everyone. I try to make some Core_ files for my projects, so i just can add them into the projects. Everything works fine except when i try to compile the "Core_System" file. I made a class in "Core_System.h" named cApplication, and i tryed to make a function called MsgProc. And it just dont work and the complier complains on the specifier. some Code: class cApplication { private: ~ public: ~ //the problem is here// virtual FAR PASCAL MsgProc(HWND hWindow, UINT uMessage, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWindow, uMessage, wParam, lParam); } }; and im generating those errors error C4430: missing type specifier - int assumed. Note: C++ does not support default-int I´m using DirectX 9.0 and C++ can someone help me? Thanks in advance

Share this post


Link to post
Share on other sites
FAR and PASCAL are calling conventions, not return types. You need to specify a return type, ie:

FAR PASCAL int MsgProc(...)

I'd drop the FAR and PASCAL, as they're only there for Win32 API conformance, and the Win32 API cannot call a function in a class directly anyway. You'll need a global C style function (of FAR PASCAL int MsgProc.... type) which will then call the appropriate object's MsgProc. The function in the class doesn't need to be FAR PASCAL, and will only serve to confuse people.

Share this post


Link to post
Share on other sites
Moved to 'General Programming' and deleted the extra 2 copies

Despite the fact that you might be doing DirectX programming, this is more of a general programming/Win32 problem. There isn't anything that you've posted that is specific to the DirectX API.

Seems like you've got a couple of good answers already, but you'll get more by having it located in the right forum [smile]

Cheers
Jack

Share this post


Link to post
Share on other sites
1) You don't really need the FAR PASCAL bit, since this can't be a window proc because it's a member of a class. If you intend to use it as a window procedure, search for "window procedure in a class", or see Here
2) Window procedures should return an LRESULT, Dialog procs should return a BOOL; not an int.

Share this post


Link to post
Share on other sites
Thanks everyone for those great answers!
I will try the examples you gave me.
I´m sorry if this was the wrong forum bt this is actually the first time i
post anything here in GameDev. And i must say that this is a brilliant site
for begginers to pro´s.

Once again thanks =)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this