Operating System - HP-UX
1752799 Members
6202 Online
108789 Solutions
New Discussion юеВ

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

 
Raheel A
Advisor

error #2513: a value of type "void *" cannot be assigned to an entity of type ...

I am using aCC compiler:
bash-2.04# aCC -V
aCC: HP C/aC++ B3910B A.06.20 [May 13 2008]

and I keep getting these casting related error messages. Is there a way to make this compiler "less strict" or treat these as warnings. The same code wouldn't generate this error message on other platforms like AIX using Xlc

thanks
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

>Is there a way to make this compiler "less strict" or treat these as warnings.

No, this has always been illegal in C++, though legal in C.

>The same code wouldn't generate this error message on other platforms like AIX using Xlc

You better get a message.
Steven Schweda
Honored Contributor

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

A sample module which exhibits the problem
would have been a nice touch here. Or even
a complete actual error message. (I can't
help wondering which type that is, but if
you're too lazy to say, then I'm too lazy to
start guessing.)
Raheel A
Advisor

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

i got these all over the place for different types..some examples are:

error #2513: a value of type "void *" cannot be assigned to an entity of type "char *"

error #2513: a value of type "const char *"
cannot be assigned to an entity of type "char *"

Raheel A
Advisor

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

char *next;
next = strstr(classPath, str);

this code produces the const char * message where classPath and str are both of type const char *

---------------------

char* childEnv=malloc(bufferSize);

--------------------
BOOL inQuotes = FALSE;
if (..) {
inQuotes = !inQuotes;
}
produces
error #2513: a value of type "bool" cannot
be assigned to an entity of type "BOOL"
where BOOL is defined to be of type int..


Raheel A
Advisor

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

on further research, i realized that this is a "c" file and not c++ (cpp) and from what i read, in C, its ok not to case eg in case of malloc but in c++ you have to..so what flag can i use for aCC for it treat it as a C file?
Dennis Handly
Acclaimed Contributor

Re: error #2513: a value of type "void *" cannot be assigned to an entity of type ...

>I realized that this is a "C" file and not C++ (cpp) and from what I read, in C, its ok not to cast eg in case of malloc but in C++ you have to.

I suspected that.

>what flag can I use for aCC for it treat it as a C file?

Since both compilers are in the same bundle, you compile with cc and not aCC.