Can't make a COM Object external

S

Stefan

Hi,
I cannot make my COM Object external, so I can access it from other
..cpp project files. Here is a bit of the code:

(globals.cpp)
....
#include "globals.h"
#include <oleacc.h>
#include <mshtml.h>
#include <atlbase.h>
....

CComPtr<IHTMLDocument2> spDoc;


(globals.h)
#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <oleacc.h>
#include <assert.h>
#include "msctf.h"

....
extern CComPtr<IHTMLDocument2> spDoc;


The problem is with the extern line in globals.h I think, but I don't
know how to fix it. Could someone please help me?
 
K

Karl Heinz Buchegger

Stefan said:
Hi,
I cannot make my COM Object external, so I can access it from other
.cpp project files. Here is a bit of the code:

(globals.cpp)
...
#include "globals.h"
#include <oleacc.h>
#include <mshtml.h>
#include <atlbase.h>
...

CComPtr<IHTMLDocument2> spDoc;

(globals.h)
#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <oleacc.h>
#include <assert.h>
#include "msctf.h"

...
extern CComPtr<IHTMLDocument2> spDoc;

The problem is with the extern line in globals.h I think, but I don't
know how to fix it. Could someone please help me?

What is the error message ?
 
S

Stefan

" Globals.h(127): error C2143: syntax error : missing ';' before '<' "
Line 127 is: "extern CComPtr<IHTMLDocument2> spDoc;"
 
K

Karl Heinz Buchegger

Stefan said:
" Globals.h(127): error C2143: syntax error : missing ';' before '<' "
Line 127 is: "extern CComPtr<IHTMLDocument2> spDoc;"

You need additional includes in Globals.h.
The compiler has no idea what a CComPtr is.
Include the header file which declares that and
you should be fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top