Click here to Skip to main content
15,915,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to get application file name? Pin
Prakash Nadar4-Apr-04 5:15
Prakash Nadar4-Apr-04 5:15 
GeneralRe: how to get application file name? Pin
John R. Shaw4-Apr-04 9:36
John R. Shaw4-Apr-04 9:36 
AnswerRe: how to get application file name? Pin
GflPower4-Apr-04 14:17
GflPower4-Apr-04 14:17 
AnswerRe: how to get application file name? Pin
avenger_sb255-Apr-04 5:27
avenger_sb255-Apr-04 5:27 
GeneralCustom CListCtrl Pin
Halloko4-Apr-04 0:30
Halloko4-Apr-04 0:30 
GeneralRe: Custom CListCtrl Pin
avenger_sb255-Apr-04 5:32
avenger_sb255-Apr-04 5:32 
GeneralRe: Custom CListCtrl Pin
Halloko5-Apr-04 5:48
Halloko5-Apr-04 5:48 
GeneralSad tale of 'const' Pin
73Zeppelin4-Apr-04 0:11
73Zeppelin4-Apr-04 0:11 
This innocent looking little bit o' code:

double CROT_Optimizer::DoStrongWolfeSearch(const CSpringNode& TempNode, const CMatrix& rGradient, const CMatrix& rMatrix_p)
{

#ifndef WORK_IN_SILENCE
	TRACE ("Starting Wolfe line search...\n");
#endif

#ifdef _DEBUG
	UINT nfe = 0;		// number of function evaluations
	UINT nge = 0;		// number of gradient evaluations
#endif	

	CMatrix Position(2,1);
	Position.SetElement(0,0, TempNode.m_M3DNodePosition.x);
	Position.SetElement(1,0, TempNode.m_M3DNodePosition.y);

	// The necessary variables:
	double alpha = 0.0;
//	double FunctionVal = CalculateNodeEnergy(TempNode);
	double FunctionVal = PESurfaceValueAtNode(TempNode);
	CMatrix Gradient(2,1);
	Gradient = rGradient;


causes me the following headaches:
Compiling...
ROT_Optimizer.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1521) : error C2664: 'PESurfaceValueAtNode' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1569) : error C2166: l-value specifies const object
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1570) : error C2166: l-value specifies const object
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1573) : error C2664: 'PESurfaceValueAtNode' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1591) : error C2664: 'FirstXDerivative' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1592) : error C2664: 'FirstYDerivative' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1670) : error C2166: l-value specifies const object
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1671) : error C2166: l-value specifies const object
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1674) : error C2664: 'PESurfaceValueAtNode' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1690) : error C2664: 'FirstXDerivative' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\PATI May 5\ROT_Optimizer.cpp(1691) : error C2664: 'FirstYDerivative' : cannot convert parameter 1 from 'const class CSpringNode' to 'class CSpringNode &'
        Conversion loses qualifiers
Generating Code...
Compiling...
AbstractSpringSolver.cpp
Generating Code...
Skipping... (no relevant changes detected)
PatiKernalTester.cpp
PatiStretch.cpp
Error executing cl.exe.
Creating browse info file...

Presenter.exe - 11 error(s), 0 warning(s)


The sad tale is that I am not sure why this is...Cry | :((
There is obviously a problem with the const keyword going on here, but
the function prototype is fine...
Help appreciated.

thx.

<EDIT>
I think I am seeing the problem now...the complaining functions want to
modify the reference and since it has been declared const I am getting
the compile errors, yes?
</EDIT>



John Theal
Physicist at Large

Got CAD?
http://www.presenter3d.com[^]
GeneralRe: Sad tale of 'const' Pin
Neville Franks4-Apr-04 0:37
Neville Franks4-Apr-04 0:37 
GeneralRe: Sad tale of 'const' Pin
73Zeppelin4-Apr-04 0:40
73Zeppelin4-Apr-04 0:40 
GeneralRe: Sad tale of 'const' Pin
Neville Franks4-Apr-04 1:34
Neville Franks4-Apr-04 1:34 
GeneralRe: Sad tale of 'const' Pin
Jörgen Sigvardsson4-Apr-04 9:04
Jörgen Sigvardsson4-Apr-04 9:04 
Generalspecifying a map Pin
MatthewP3-Apr-04 22:43
MatthewP3-Apr-04 22:43 
GeneralRe: specifying a map Pin
Andrew Walker3-Apr-04 23:52
Andrew Walker3-Apr-04 23:52 
Generalmap container Pin
MatthewP3-Apr-04 22:41
MatthewP3-Apr-04 22:41 
GeneralRe: map container Pin
Johnny ²3-Apr-04 23:45
Johnny ²3-Apr-04 23:45 
Generalapp not compatable between XP and 2000 Pin
quzi3-Apr-04 21:50
quzi3-Apr-04 21:50 
GeneralRe: app not compatable between XP and 2000 Pin
Alexander M.,4-Apr-04 1:03
Alexander M.,4-Apr-04 1:03 
GeneralRe: app not compatable between XP and 2000 Pin
quzi4-Apr-04 1:25
quzi4-Apr-04 1:25 
QuestionHow to create an ActiveX in Visual Studio? Pin
anderslundsgard3-Apr-04 21:48
anderslundsgard3-Apr-04 21:48 
GeneralQuestion on serial port and data buffer Pin
knightri3-Apr-04 17:11
knightri3-Apr-04 17:11 
GeneralRe: Question on serial port and data buffer Pin
Simon.W3-Apr-04 17:21
Simon.W3-Apr-04 17:21 
GeneralRe: Question on serial port and data buffer Pin
knightri4-Apr-04 10:29
knightri4-Apr-04 10:29 
GeneralRe: Question on serial port and data buffer Pin
Simon.W5-Apr-04 1:14
Simon.W5-Apr-04 1:14 
GeneralRe: Question on serial port and data buffer Pin
Paul Ranson4-Apr-04 13:01
Paul Ranson4-Apr-04 13:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.