error C2065: 'IFirst_ATL' : undeclared identifier
// First.cpp : Implementation of CFirst#include "stdafx.h"
#include "Simple_ATL.h"
#include "First.h"
#include <iostream.h>
/////////////////////////////////////////////////////////////////////////////
// CFirst
STDMETHODIMP CFirst::AddNumbers(long Num1, long Num2, long *ReturnVal)
{
// TODO: Add your implementation code here
*ReturnVal=Num1+Num2;
return S_OK;
}
#include "C:\Program Files\Microsoft Visual Studio\MyProjects\Simple_ATL\Simple_ATL.h"
#include "C:\Program Files\Microsoft Visual Studio\MyProjects\Simple_ATL\Simple_ATL_i.c"
void main(void)
{
//声明Simple_ATL接口指针
HRESULT hr;
IFirst_ATL*IFirstATL=NULL;
hr=CoInitialize(NULL);
if(SUCCEEDED(hr))
{
hr=CoCreateInstance(CLSID_First,
NULL,
CLSCTX_INPROC_SERVER,
IID_IFirst_ATL,
(void* *)&IFirstATL);
if(SUCCEEDED(hr))
{
long ReturnValue;
IFirstATL->AddNumbers(5,7,&ReturnValue);
cout<<"the answer for 5+7 is:"
<<ReturnValue<<endl;
IFirstATL->Release();
}
else
{
cout<<" cocreateinstance failed."<<endl;
}
}
CoUninitialize();
}
//请问这个该怎样申明啊
D:\MSDev98\MyProjects\Simple_ATL\First.cpp(24) : error C2065: 'IFirst_ATL' : undeclared identifier
D:\MSDev98\MyProjects\Simple_ATL\First.cpp(24) : error C2065: 'IFirstATL' : undeclared identifier
D:\MSDev98\MyProjects\Simple_ATL\First.cpp(24) : error C2106: '=' : left operand must be l-value
D:\MSDev98\MyProjects\Simple_ATL\First.cpp(31) : error C2065: 'IID_IFirst_ATL' : undeclared identifier
D:\MSDev98\MyProjects\Simple_ATL\First.cpp(36) : error C2227: left of '->AddNumbers' must point to class/struct/union
D:\MSDev98\MyProjects\Simple_ATL\First.cpp(39) : error C2227: left of '->Release' must point to class/struct/union