Discussion:
help with ATL compiler
(too old to reply)
Xavier MT
2004-04-12 02:42:40 UTC
Permalink
Hi, Im compiling a simple ATL Com but I get the following error, and it just
doesn't make sense...

It is a very simple example obtained from a tutorial...

E:\test>cl /LD MyServer.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

MyServer.cpp
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlcom.h(2945) :
error
C2065: '_Module' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlcom.h(2945) :
error
C2228: left of '.Lock' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlcom.h(2947) :
error
C2228: left of '.Unlock' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlcom.h(3318) :
error
C2228: left of '.m_csTypeInfoHolder' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlcom.h(3340) :
error
C2228: left of '.m_csTypeInfoHolder' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlcom.h(3341) :
error
C2228: left of '.AddTermFunc' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlwin.h(2912) :
error
C2228: left of '.GetModuleInstance' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\VC98\atl\include\atlwin.h(2974) :
error
C2228: left of '.GetModuleInstance' must have class/struct/union type
MyIncludes.h(12) : fatal error C1083: Cannot open include file:
'atltypes.h': No
such file or directory

This is the header im using

#pragma once

#define STRICT

#ifndef _WIN32_WINNT

#define _WIN32_WINNT 0x0501

#endif

#define _ATL_ATTRIBUTES

#define _ATL_APARTMENT_THREADED

#define _ATL_NO_AUTOMATIC_NAMESPACE

#include <atlbase.h>

#include <atlcom.h>

#include <atlwin.h>

#include <atltypes.h>

#include <atlctl.h>

#include <atlhost.h>

using namespace ATL;
Hyungchul Shin[MVP]
2004-04-12 15:56:29 UTC
Permalink
You should declare a extern variable with type CComCodule like so
in the header file stdafx.h

....

#include <atlbase.h>

extern CComModule _Module;

#include <atlcom.h>

....





-========================================-
HyungChul Shin
Microsoft MVP - [ Visual C++ ]
Post by Xavier MT
Hi, Im compiling a simple ATL Com but I get the following error, and it just
doesn't make sense...
It is a very simple example obtained from a tutorial...
E:\test>cl /LD MyServer.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
MyServer.cpp
error
C2065: '_Module' : undeclared identifier
error
C2228: left of '.Lock' must have class/struct/union type
error
C2228: left of '.Unlock' must have class/struct/union type
error
C2228: left of '.m_csTypeInfoHolder' must have class/struct/union type
error
C2228: left of '.m_csTypeInfoHolder' must have class/struct/union type
error
C2228: left of '.AddTermFunc' must have class/struct/union type
error
C2228: left of '.GetModuleInstance' must have class/struct/union type
error
C2228: left of '.GetModuleInstance' must have class/struct/union type
'atltypes.h': No
such file or directory
This is the header im using
#pragma once
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define _ATL_ATTRIBUTES
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
using namespace ATL;
Xavier MT
2004-04-14 05:13:58 UTC
Permalink
Thanks, I tried that but now I get new errors.

Do you know of a source where I can find the instructions to create the COM?
Step by step to see what I am doing wrong...

The error I get is

MyIncludes.h(13) : fatal error C1083: Cannot open include file:
'atltypes.h': No
such file or directory

I set INCLUDE the path, and now I get a new error saying that it needs a
library that already is there

Any ideas?
Post by Hyungchul Shin[MVP]
You should declare a extern variable with type CComCodule like so
in the header file stdafx.h
....
#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
....
-========================================-
HyungChul Shin
Microsoft MVP - [ Visual C++ ]
Post by Xavier MT
Hi, Im compiling a simple ATL Com but I get the following error, and it
just
Post by Xavier MT
doesn't make sense...
It is a very simple example obtained from a tutorial...
E:\test>cl /LD MyServer.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for
80x86
Post by Xavier MT
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
MyServer.cpp
error
C2065: '_Module' : undeclared identifier
error
C2228: left of '.Lock' must have class/struct/union type
error
C2228: left of '.Unlock' must have class/struct/union type
error
C2228: left of '.m_csTypeInfoHolder' must have class/struct/union type
error
C2228: left of '.m_csTypeInfoHolder' must have class/struct/union type
error
C2228: left of '.AddTermFunc' must have class/struct/union type
error
C2228: left of '.GetModuleInstance' must have class/struct/union type
error
C2228: left of '.GetModuleInstance' must have class/struct/union type
'atltypes.h': No
such file or directory
This is the header im using
#pragma once
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define _ATL_ATTRIBUTES
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
using namespace ATL;
Igor Tandetnik
2004-04-14 15:15:13 UTC
Permalink
Post by Xavier MT
Thanks, I tried that but now I get new errors.
Do you know of a source where I can find the instructions to create
the COM? Step by step to see what I am doing wrong...
The error I get is
'atltypes.h': No
such file or directory
You are using VC6 which includes ATL3. atltypes.h is shipped with ATL7,
included with VC7 and VC7.1. You don't have it, and the compiler tells
you so.
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Loading...