Errors porting ATL with MFC from VC98 to VS2008

I'm porting a project that was originally developed using VC98 to VS2008.  The project is an ATL .exe with MFC.  In my Stdafx.h if I include the files in this order:

#include <atlbase.h>

extern CComModule _Module;
#include <atlcom.h>

#include <afxwin.h>   // MFC core and standard components

I get this error:

Error      1      fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>      C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxv_w32.h      16      editclm


However if I move the afxwin.h up:

#include <afxwin.h>   // MFC core and standard components
#include <atlbase.h>

extern CComModule _Module;
#include <atlcom.h>

Some classes aren't found and I get this error:

Error      3      error C2065: 'IRulesEngine' : undeclared identifier      c:\Projects\src\editclm\hpedit.cpp      37      editclm
Error      4      error C2133: 'm_pIRulesEngine' : unknown size      c:\Projects\src\editclm\hpedit.cpp      37      editclm
Error      5      error C2512: 'ATL::CComPtr' : no appropriate default constructor available      c:\Projects\src\editclm\hpedit.cpp      37      editclm

There must be a way to port this project...  but I've looked everywhere.
DanintulsaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pgnatyukCommented:
You have a compilation error in hpedit.cpp file. Fix it.
IRulesEngine is an interface in your code. Find this declaration in your code. It can be an external interface too - so you should have a source code for this com-object or this com-object registered on your computer and a description of this com-object.

CComPtr is in atlbase.h that is included in your stdafx.h
http://msdn.microsoft.com/en-us/library/ezzw7k98(VS.80).aspx

So I think the problem with this RulesEngine com-object.


0
DanintulsaAuthor Commented:
IRulesEngine is a com object written in C# and exported.

From hpedit.cpp

#import "..\..\inc\InterOp.tlb" no_namespace named_guids

Does hpedit.cpp need to be importing this class in a different way?
0
pgnatyukCommented:
Just a matter of fact: error C2065: 'IRulesEngine' : undeclared identifier.
You can move this line to your stdafx.h. But... you don't see something and from the information you posted I cannot find.
Re-build this project with the com-object (this tlb-file).
You can use simply #include for the header file with this interface declared. You can include the h-file in stdafx and _i.c file in stdafx.cpp. In this case you will not need to import this tlb-file.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DanintulsaAuthor Commented:
Hmmm... Well, apparently the tlb was out of date.  I pulled its source code and did a fresh build, and things are fine now.
0
pgnatyukCommented:
Fine. Congratulations.
So http:#a29126150 is the answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.