type specifier - int assumed.

Started by
4 comments, last by Lucas W 17 years, 11 months ago
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
-----------------------------------------------------I demand more toasties!
Advertisement
Are you sure FAR PASCAL is defined before it's used there? That's a common source of those types of errors.
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.
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

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.
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 =)
-----------------------------------------------------I demand more toasties!

This topic is closed to new replies.

Advertisement