The build error mentioned in the compilation log is trivial to fix, GCC even tells you what to do: Get rid of the default parameter in the function definition, as done in the attached patch for the mentioned occurrence and an additional one (default-arguments-in-definition.patch).

However, the compilation with GCC 4.9 fails at a second point, too. This is due to bug #61659 in GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659). I've attached a workaround for this problem (gcc-4-9-workaround.patch) - in case you don't want to wait for the GCC guys to fix the bug (it sounds complicated, could take a while, they've been fumbling for 2 months now).

With those 2 patches applied, sofa-framework-1.0~beta4 compiles fine with gcc 4.9.

Cheers,
Martin

Description: No default arguments in function redeclaration
 Compilation fix: Default arguments for function parameters are only
 allowed in the original function declaration, not in redeclarations
 (like the definition of functions that have already been declared).
 They are unnecessary anyway because the default parameters have
 already been set in the function declarations.
Author: Martin Steghöfer <[email protected]>
Bug-Debian: https://bugs.debian.org/746910

--- sofa-framework-1.0~beta4.orig/framework/sofa/core/objectmodel/Data.h
+++ sofa-framework-1.0~beta4/framework/sofa/core/objectmodel/Data.h
@@ -278,7 +278,7 @@ bool TData<bool>::read( std::string& str
 /// General case for printing default value
 template<class T>
 inline
-void TData<T>::printValue( std::ostream& out=std::cout ) const
+void TData<T>::printValue( std::ostream& out ) const
 {
     out << value() << " ";
 }
--- a/modules/sofa/component/misc/Monitor.inl
+++ b/modules/sofa/component/misc/Monitor.inl
@@ -181,7 +181,7 @@
 
 	/////////////////////////// fwdDraw () ////////////////////////////////////
 	template<class DataTypes>
-	void Monitor<DataTypes>::fwdDraw ( Pass pass = Std )
+	void Monitor<DataTypes>::fwdDraw ( Pass pass )
 	{
 		if ( pass == core::VisualModel::Std )
 		{			
Description: Workaround for gcc 4.9 bug
 Workaround for bug #61659 in gcc 4.9.[0|1]:
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659
Author: Martin Steghöfer <[email protected]>

--- a/framework/sofa/core/CollisionModel.cpp
+++ b/framework/sofa/core/CollisionModel.cpp
@@ -77,3 +77,6 @@
 
 } // namespace sofa
 
+// workaround for gcc 4.9.[0|1] bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659
+template class sofa::core::objectmodel::TData<sofa::defaulttype::Vec<4, float> >;
+

Reply via email to