Click to See Complete Forum and Search --> : how to use MFC classes?


PeiFeng
April 23rd, 2003, 01:50 AM
I create a simple Win32 application and i want to use
MFC classes,what shuold i do?

e.g when I adding the line:

#include <afxtempl.h>

I got the error message:

#ifdef _WINDOWS_
#error WINDOWS.H already included. MFC apps must not #include <windows.h>
#endif

anyone help?
Regards!

--XiePeifeng

mahanare
April 23rd, 2003, 04:39 AM
Originally posted by PeiFeng
I create a simple Win32 application and i want to use
MFC classes,what shuold i do?
#include <afxtempl.h>

I got the error message:

#ifdef _WINDOWS_
#error WINDOWS.H already included. MFC apps must not #include <windows.h>
#endif

--XiePeifeng

If you woudn't mind can you try the following.

Project->setting in general tab,
select use "MFC in a shared DLL"

and include your mfc header file in stdafx.h before windows.h
to saticify the compiler.
then do the work it may help you,
r u able to get me?

cheers
mahanare

PeiFeng
April 23rd, 2003, 06:26 AM
Originally posted by mahanare
If you woudn't mind can you try the following.

Project->setting in general tab,
select use "MFC in a shared DLL"

and include your mfc header file in stdafx.h before windows.h
to saticify the compiler.
then do the work it may help you,
r u able to get me?

cheers
mahanare

Thank you mahanare.
Your method works good!

But in my program the Project->setting
in general tab should select "MFC in saticify"

Have a good day!

mahanare
April 23rd, 2003, 06:50 AM
is it?
Then good, regarding project setting.
yes, certainly you should select "Use MFC in shared DLL"
Because MFC s are implemented as a DLL, in other case you will be getting some linker errors, saying that some external symbol not found.

O.K then Enjoy vc++ programming.
best wishes

cheers
mahanare