Compiling Source Code

Matthew Gabeler-Lee msg2 "at" po.cwru.edu
Wed, 30 Dec 1998 15:36:41 +0000


Older compilers and versions of the C/C++ spec allowed implicit conversion
from void * to any other pointer type.  It appears that this is no longer
allowed in VC6.  Most compilers have options to turn such errors/warnings
on or off, although I can't seem to find it in the options for VC6.  The
easy solution, obviously, is to use an explicit cast rather than an
implicit one.
hInstance = hInst;
becomes
hInstance = (HINSTANCE__ *)hInst;
you can probably change HINSTANCE__ to HINSTANCE since the double
underscores are usually used something like this:
struct HINSTANCE__ {
    //....
};
typdef struct HINSTANCE__ HINSTANCE;
This is to make life easier for people who are using C compilers that don't
allow things like
typedef struct HINSTANCE HINSTANCE;

Always providing more semi-useless information than you probably wanted to
know
    -Matt

gbreland "at" healthtech.net wrote:

> Has anyone compiled the server source under Microsoft Visual C++ 6.0
> yet?  I tried and got a fatal error in VNCHooks.cpp for the line:
>
> hInstance = hInst;
>
> This is the error code I got
>
> --------------------Configuration: VNCHooks - Win32
> No_CORBA--------------------
> Compiling...
> VNCHooks.cpp
> D:\VNC\VNCcode\winvnc\VNCHooks\VNCHooks.cpp(101) : error C2440: '=' :
> cannot convert from 'void *' to 'struct HINSTANCE__ *'
>         Conversion from 'void*' to pointer to non-'void' requires an
> explicit cast
> Error executing cl.exe.
>
> VNCHooks.dll - 1 error(s), 0 warning(s)
>
> I cannot seem to figure this out.  If I have to, I can reinstall Visual
> C++ 5.0 on another machine, but 6.0 should be able to compile the
> source.  I have not tried the client sources yet, but I suspect I will
> get the same error there too.
>
> ---------------------------------------------------------------------
> The VNC mailing list     -   see http://www.orl.co.uk/vnc/intouch.html
> ---------------------------------------------------------------------


---------------------------------------------------------------------
The VNC mailing list     -   see http://www.orl.co.uk/vnc/intouch.html
---------------------------------------------------------------------