I recently changed all of my source files to .cpp so I could begin
implementing in C++. Many error appeared which were all mainly
variables that were C++ keywords like new, this. One error has left me
stumped. I would appreciate any suggestions.
here are the errors:
C:\GodsForge\src\mail.cpp(425) : error C2440: 'type cast' : cannot
convert from 'void *' to 'struct char_data'
No constructor could take the source type, or
constructor overload resolution was ambiguous
C:\GodsForge\src\mail.cpp(428) : error C2664: 'postmaster_check_mail' :
cannot convert parameter 2 from 'void *' to 'struct char_data *'
C:\GodsForge\src\mail.cpp(431) : error C2664: 'postmaster_receive_mail'
: cannot convert parameter 2 from 'void *' to 'struct char_data *'
here is the code: (its all stock bpl9 code, but I will include it anyway
#define SPECIAL(name) int (name)(struct char_data *ch, void *me, int
cmd, char *argument)
SPECIAL(postmaster)
{
if (!ch->desc || IS_NPC(ch))
return 0; /* so mobs don't get caught here */
if (!(CMD_IS("mail") || CMD_IS("check") || CMD_IS("receive")))
return 0;
if (no_mail) {
send_to_char("Sorry, the mail system is having technical
difficulties.\r\n", ch);
return 0;
}
if (CMD_IS("mail")) {
postmaster_send_mail(ch, (struct char_data)me, cmd, argument);
return 1;
} else if (CMD_IS("check")) {
postmaster_check_mail(ch, me, cmd, argument);
return 1;
} else if (CMD_IS("receive")) {
postmaster_receive_mail(ch, me, cmd, argument);
return 1;
} else
return 0;
}
void postmaster_send_mail(struct char_data * ch, struct char_data
*mailman, int cmd, char *arg)
void postmaster_check_mail(struct char_data * ch, struct char_data
*mailman, int cmd, char *arg)
void postmaster_receive_mail(struct char_data * ch, struct char_data
*mailman, int cmd, char *arg)
I changed nothing in the code, just the file type. I tried type-casting
to void pointer to char_data, but it said something bout the
constructor. Its a struct does it have a constructor, maybe a default
constructor? Why wont it convert from void to struct char_data? Well
I'm stumped, I hope someone can help me oput a bit.
@****************************************************************************@
The criminal is stupid and ignorant. Stupidity and ingnorance can
therefor
be called criminal.
- L. Ron Hubbard
@****************************************************************************@
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST