I'm converting a C program written for Solaris to a Windows 32 console program using Visual Studio 2005.
In my t_main function (found in test1.cpp), the following is declared:
When I try to compile, I get the following error in my initmole.cpp page:Code:MOLECULE *m = NULL;
I'm pretty sure that I have to perform a cast on molecule *m in initmole.cpp. However, m is an array/struct so I have no idea on how to cast it. Below isCode:error C2440: '=' : cannot convert from 'int *' to 'MOLECULE *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
the code for initmole.cpp. How/where would I want to perform a cas?
Code:MOLECULE *InitMol( void ) { MOLECULE *m; if ( (m = malloc( sizeof( *m ) )) == NULL ) { //this where it errors out return( NULL ); } m->N_Hydro = -1; m->N_Atoms = 0; m->N_Bonds = 0; m->N_Comps = 0; return( m ); }



LinkBack URL
About LinkBacks


