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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
pgnatyukConnect With a Mentor Commented:
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
 
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
 
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
All Courses

From novice to tech pro — start learning today.