Hi
Just starting out with VS2008 C++
I'm trying to compile code from an old C++ project into a Windows Forms project. When I compile I'm getting LNK2028 errors for several of the objects of a Class. The Class is declared in a CLASSES.h file but does not seem to be recognized in the SIGNAL.cpp file. Here is the error which is typical of several:
Error 1 error LNK2028: unresolved token (0A000009) "void * __clrcall memrealloc(void *,unsigned int)" (?memrealloc@@$$FYMPAXPAXI@Z) referenced in function "public: int __clrcall Signal::undo_difference(class Signal *)" (?undo_difference@Signal@@$$FQAMHPAV1@@Z) SIGNAL.obj
Here is the "token" (I think!) declaration in the header file FUNCDEFS.h:
extern void *memrealloc ( void *ptr , unsigned int size ) ;
Code within EXTERN.h is thus:
extern TDecoratedMDIFrame *frame ;
extern npredictMDIClient *mdiClient ;
Here is the Class declaration in the header file CLASSES.h:
class Signal {
public:
Signal ( char *signame , int length , double *signal ) ;
~Signal () ;
enum SignalType type ;
int n ;
char *name ;
double *sig ;
int centered ;
double cent ;
int detrended ;
double slope ;
double pivot ;
int offsetted ;
double offst ;
int scaled ;
double scal ;
int standardized ;
double mean ;
double std ;
int differenced ;
double leads[3] ;
int seasonal ;
double *sleads ;
int source_n ;
int known_n ;
int npred ;
double *intervals ;
int mult_conf ;
void replace ( int n , int n_protect , double *x ) ;
void center () ;
int median_center () ;
void undo_center ( Signal *per ) ;
void detrend () ;
void undo_detrend ( Signal *per ) ;
void offset ( double val ) ;
void undo_offset ( Signal *per ) ;
void scale ( double val ) ;
void undo_scale ( Signal *per ) ;
void standardize () ;
void undo_standardize ( Signal *per ) ;
void difference ( int degree ) ;
int undo_difference ( Signal *per ) ;
int seasonal_diff ( int period ) ;
int undo_seasonal_diff ( Signal *per ) ;
void integrate ( int period ) ;
void siglog () ;
void sigexp () ;
}
Here is the definition in the SIGNAL.cpp file:
int Signal::undo_difference ( Signal *sigptr )
{
int i, pass, passes ;
double temp, sum, *dptr ;
remove_display ( this ) ;
if (sigptr != NULL) {
if (sigptr->differenced)
passes = sigptr->differenced ;
else
return 0 ;
}
else
passes = differenced ;
MEMTEXT ( "SIGNAL: undo_difference" ) ;
dptr = (double *) REALLOC ( sig , (n+passes) * sizeof(double) ) ;
if (dptr == NULL)
return 1 ;
sig = dptr ;
for (pass=0 ; pass<passes ; pass++) {
if (sigptr != NULL)
sum = sigptr->leads[passes-pass-1] ;
else
sum = leads[passes-pass-1] ;
for (i=0 ; i<n ; i++) {
temp = sig[i] ;
sig[i] = sum ;
sum += temp ;
}
sig[n++] = sum ;
}
type = DataSignal ;
known_n += passes ;
return 0 ;
};
Have had a good look around on Google etc but stuck here. suspect that there might be a declaration issue with C as a .C file supplied as well but inclusion makes no difference.
I'd appreciate some direction.
Thanks