Page MenuHomePhabricator

Build warnings in mitkStateMachine.cpp and mitkStateMachineFactory.cpp
Closed, ResolvedPublic

Description

When i compile MITK under 64bit Windows 7 using Visual Studio 10 I get a
lot of the following errors:

10>..\..\..\..\..\MITK_SOURCE\MITK-2012.09.0\Core\Code\Interactions\mitkStateMachine.cpp(294):
error C2220: warning treated as error - no 'object' file generated
10>
10>..\..\..\..\..\MITK_SOURCE\MITK-2012.09.0\Core\Code\Interactions\mitkStateMachine.cpp(294):
warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned
int', possible loss of data
10>
10>..\..\..\..\..\MITK_SOURCE\MITK-2012.09.0\Core\Code\Interactions\mitkStateMachineFactory.cpp(123):
error C2220: warning treated as error - no 'object' file generated
10>
10>..\..\..\..\..\MITK_SOURCE\MITK-2012.09.0\Core\Code\Interactions\mitkStateMachineFactory.cpp(123):
warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int',
possible loss of data

So I have to disable "treat warnings as error" to successfully compile
MITK.

Event Timeline

@Christian: could you have a look at this on Wednesday? Maybe Stefan can help with Windows-specific issues.

Problem caused by implicit conversions from size_t to unsigned int.
The warning could not be reproduced with default settings on Win7 64bit, 64bit MITK build.

New remote branch pushed: bug-13589-FixBuildWarningsOfStateMachine

[8f6968]: Merge branch 'bug-13589-FixBuildWarningsOfStateMachine'

Merged commits:

2012-12-05 14:05:31 Alfred Franz [f5b2ed]
added explicit cast of vector::size() to unsigned int to avoid warnings

unfortunately there is no way to change the vtk methods which needs the unsigned int as parameter. But the size of the std::string must exceed 4.2 million characters to cause an error. This means about 400 MB text data, we think this won't happen.


2012-12-05 14:02:10 Alfred Franz [157485]
changed data type of local variable to size_t to make method safe