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

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 Here2) Window procedures should return an LRESULT, Dialog procs should return a BOOL; not an int.

0

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 ipost anything here in GameDev. And i must say that this is a brilliant sitefor begginers to pro´s.