Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 01-30-2004, 01:20 PM   #1 (permalink)
paul
Registered User
 
Join Date: Feb 2003
Location: NS, Canada
Posts: 15
paul is on a distinguished road
invalid conversion

I am trying to get away from VB and write some windows programs in C++. I am using DEV-CPP, and sometimes when I try to compile code that was written in another IDE, I get this error:

Code:
invalid conversion from 'void*' to .....
I tried a google search but all that was in the first three pages was people who had the same problem. I was wondering if anyone knew how to fix it. Thanks.
paul is offline   Reply With Quote
Old 01-31-2004, 05:04 PM   #2 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
do you have any examples for us to look at?
joe_bruin is offline   Reply With Quote
Old 02-02-2004, 04:05 AM   #3 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,694
redhead is on a distinguished road
it could be many things, usualy it's because you use a return value from a function in a way, that it wasn't intended to.

In IDE1 the function may be type int, and you use it like:
if(function(arg) > 1)
/* do stuff/*;
Then in IDE2 the function is of type void*, and it will complain that the type void* can't be directly compared to a value of type int, you can either do:
if((int)function(arg) > 1)
/* do stuff*/;
Or you can assign the return value to a variable, and then check teh value of the return in a cast like the function call was.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 02-02-2004, 10:58 AM   #4 (permalink)
paul
Registered User
 
Join Date: Feb 2003
Location: NS, Canada
Posts: 15
paul is on a distinguished road
thanks redhead, the program now compiles and runs sucessfully.

before, the code was:

Code:
WndClass.hbrBackground = GetStockObject(WHITE_BRUSH);

//and I made it

WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
paul is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GUID to string conversion milena Platform/API C++ 1 09-14-2004 12:04 PM
12 bit RGB to 16 bit RGB conversion jimst Standard C, C++ 6 06-08-2004 04:59 PM
void * conversion problems Lovecraft Standard C, C++ 6 04-28-2004 03:51 AM
Conversion Rate... MiLady Mirlyn Linux / BSD / OS X 1 05-11-2002 07:46 PM


All times are GMT -8. The time now is 12:05 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting