C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem with CArray class: need help for solving linker erro

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
venu
Guest





PostPosted: Fri Oct 24, 2003 3:23 pm    Post subject: problem with CArray class: need help for solving linker erro Reply with quote



hi

In the VC++project that i am working on, the earlier programmer had
created a CArray class. He had compiled and run the program in the
release mode.

Now when i am trying to run the code in debug mode it is giving errors
saying CArray is defined as template class( ERROR: Nontemplate class
is already defined as a template class).surprisingly this code showed
no errors when compiled in release mode.

i tried renaming the CArray class to CArraynew but it is introducing
linker errors. i am posting the code below.
Cutils.h code is as below
/*********************************************************************/
#define MAX_LEN 100

class CArraynew{

protected:
float array[MAX_LEN];
int dim;

public:
inline void SetDim(int id){dim = id;}
inline void SetArray(float a[]){for(int
i=0;i<dim;i++)array[i]=a[i];}
float fGetMaxArray(int *indx);
float fGetMinArray(int *indx);
};

#endif
/*******************************************/
Cutils.cpp code is as below

#include "stdafx.h"
#include "cutils.h"
#include "limits.h"



float CArraynew::fGetMaxArray(int *indx){
float tmp = (float) INT_MIN;
for (int i = 0; i < dim; i++)
if(array[i] > tmp) { tmp = array[i]; *indx = i;}
return(tmp);
}

float CArraynew::fGetMinArray(int *indx){
float tmp = (float) INT_MAX;
for (int i = 0; i < dim; i++)
if(array[i] < tmp) { tmp = array[i]; *indx = i;}
return(tmp);
}
/***********************************************************************/
now, in another file CRAD.cpp the code is as below........

else
{
CArraynew CAve;
CAve.SetDim(NO_RADIALS/2);
CAve.SetArray(fAvgRho);
KData.dKFPower = CAve.fGetMaxArray(&KData.iKFAngle);
KData.dKSPower = CAve.fGetMinArray(&KData.iKSAngle);
}

KData.dKFPower = dMMToDiopters(KData.dKFPower);
KData.dKSPower = dMMToDiopters(KData.dKSPower);


on compiling the project in debug mode i am getting the following
errors:

Linking...
LINK : error LNK2020: unresolved token (0A000035) atlTraceException
LINK : error LNK2020: unresolved token (0A000036)
?s_trace@CTrace@ATL@@2V12@A
LINK : error LNK2020: unresolved token (0A000048) __imp_cout
LINK : error LNK2020: unresolved token (0A000065) atlTraceString
LINK : error LNK2020: unresolved token (0A000103)
__imp_?openprot@filebuf@@2HB
LINK : error LNK2020: unresolved token (0A000124) ??_7type_info@@6B@
LINK : error LNK2020: unresolved token (0A00013F) __imp_afxData
LINK : error LNK2020: unresolved token (0A0001AA) atlTraceGeneral
LINK : error LNK2020: unresolved token (0A000262)
__imp_?wndTopMost@CWnd@@2V1@B
LINK : error LNK2020: unresolved token (0A00028A) __imp_afxTraceFlags
LINK : error LNK2020: unresolved token (0A000316)
__imp_?wndTop@CWnd@@2V1@B
LINK : error LNK2020: unresolved token (0A00039B) __imp__DebugHeapTag
LINK : fatal error LNK1120: 12 unresolved externals

Build log was saved at "...DebugBuildLog.htm"
13 error(s), 70 warning(s)


---------------------- Done ----------------------

Build: 1 succeeded, 1 failed, 0 skipped

Can somebody please help me out?

Venu

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.