Skip to main content
gamedev.net
🔒 Locked

Implementing c++ classes.

Started by Kechong Mar 27, 2000 at 7:30 PM 5 replies 450+ views
Original Post
Kechong
Kechong
I`m trying to add classes in my game but, when i compile with msvc++, I get link errors like "undeclared identifier" ? Yes I have included the header file ! Can anyone help ? KDX
Muzzafarath
Muzzafarath
Some code samples would help.

Are you sure that you''ve spelled the class name correctly? C++ is case sensitive (THING is not the same as thing) you know.

/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Kechong
Kechong
Yeah spelled correctly. I think its because i tried to create an instance of the class within a .C file and u cant do that or something ? I`ve tried renaming file to .cpp, but i get some other errors..... K-(, is there anything else i need to change ?
Thanks
birkeh
birkeh
You have to put an >> extern "C" << statement at the beginning of your code.
Just take a look at http://members.chello.at/birkeh where you can find a sample MFC application wich uses the WINUTIL and DEVDLG as a CPP file.
birkeh
birkeh
Sorry, correct spelling is WHICH ...
Kechong
Kechong
I cant use it because i''m using PR 2.6 :-(.
I had a look at the winutil and devdlg files and the main difference is it has

#ifdef __cplusplus
extern "C" {
#endif

.........

#ifdef __cplusplus
}
#endif

I added these in, but i still get errors, do u have a 2.6 example
;-))))))) ?
Thanks
KDX
birkeh
birkeh
Take the original WINUTIL.C and DEVDLG.C, rename them to .CPP and remove all "lpvtbl->" (xy->lpvtbl->ab(xy, ...) turns to xy->ab(...)).

That''s all I''ve done to my WINUTIL and DEVDLG.

Take only .CPP files, it''s easier ...

Herwig

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.