Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   error C2040: 'hFlag' : 'void *' differs in levels of indirection from 'int' (http://www.velocityreviews.com/forums/t460413-error-c2040-hflag-void-differs-in-levels-of-indirection-from-int.html)

Angus 02-12-2007 12:16 PM

error C2040: 'hFlag' : 'void *' differs in levels of indirection from 'int'
 
I am using a global which is a void*

I have it defined in one file as:
void* hFlag;


and one other header file as:
extern void* hFlag;


But I get this compile error:


error C2040: 'hFlag' : 'void *' differs in levels of indirection from
'int'


I can't understand what the problem is. I have another global
variable which is not void* and that works ok. I assume void* is the
problem. How can I fix it?


Ron Natalie 02-12-2007 12:31 PM

Re: error C2040: 'hFlag' : 'void *' differs in levels of indirectionfrom 'int'
 
Angus wrote:

>
> error C2040: 'hFlag' : 'void *' differs in levels of indirection from
> 'int'
>
>
> I can't understand what the problem is. I have another global
> variable which is not void* and that works ok. I assume void* is the
> problem. How can I fix it?
>

Somewhere you have hFlag defined as int, or it picked up some inmplicit
int declaration (not supposedly possible in C++).

Are you sure there's not an:
extern hFlag;
somewhere?


Clark S. Cox III 02-12-2007 12:31 PM

Re: error C2040: 'hFlag' : 'void *' differs in levels of indirectionfrom 'int'
 
Angus wrote:
> I am using a global which is a void*


I've already responded to your question in comp.lang.c. Please, either
learn to cross-post properly or do not cross-post at all. (BTW,
cross-posting between comp.lang.c and comp.lang.c++ is rarely
appropriate, as C and C++ are two different languages)

--
Clark S. Cox III
clarkcox3@gmail.com


All times are GMT. The time now is 02:33 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.