Home › Forum › SOFA › Building SOFA › [SOLVED] TriangleModel.h:284:88: error: no match for ‘operator*’
- This topic has 4 replies, 3 voices, and was last updated 9 years ago by Hugo.
-
AuthorPosts
-
18 November 2015 at 04:29 #4164jnbrunetModerator
I had an error while compiling the framework:
[ 40%] Building CXX object SofaCommon/SofaMeshCollision/CMakeFiles/SofaMeshCollision.dir/MeshMinProximityIntersection.cpp.o In file included from /home/nic/sofa/SofaCommon/../modules/SofaMeshCollision/MeshIntTool.h:10:0, from /home/nic/sofa/SofaCommon/../modules/SofaMeshCollision/MeshMinProximityIntersection.h:31, from /home/nic/sofa/modules/SofaMeshCollision/MeshMinProximityIntersection.cpp:25: /home/nic/sofa/SofaCommon/../modules/SofaMeshCollision/TriangleModel.h: In instantiation of ‘const typename DataTypes::Coord& sofa::component::collision::TTriangle<TDataTypes>::p1Free() const [with TDataTypes = sofa::defaulttype::StdVectorTypes<sofa::defaulttype::Vec<3, double>, sofa::defaulttype::Vec<3, double>, double>; typename DataTypes::Coord = sofa::defaulttype::Vec<3, double>]’: /home/nic/sofa/modules/SofaMeshCollision/MeshMinProximityIntersection.cpp:322:40: required from here /home/nic/sofa/SofaCommon/../modules/SofaMeshCollision/TriangleModel.h:284:88: error: no match for ‘operator*’ (operand type is ‘const sofa::helper::vector<sofa::defaulttype::Vec<3, double>, sofa::helper::CPUMemoryManager<sofa::defaulttype::Vec<3, double> > >’) inline const typename DataTypes::Coord& TTriangle<DataTypes>::p1Free() const { return (*(this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue()))[(*(this->model->triangles))[this->index][0]]; }
Here is my configuration:
$ uname -a Linux jn-desktop 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux $ git branch * master $ update-alternatives --display cc cc - auto mode link currently points to /usr/bin/gcc $ /usr/bin/gcc --version gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
I fixed it with this :
diff --git a/modules/SofaMeshCollision/TriangleModel.h b/modules/SofaMeshCollision/TriangleModel.h index eec881e..2af0ed3 100644 --- a/modules/SofaMeshCollision/TriangleModel.h +++ b/modules/SofaMeshCollision/TriangleModel.h @@ -281,11 +281,11 @@ inline const typename DataTypes::Coord& TTriangle<DataTypes>::operator[](int i) } template<class DataTypes> -inline const typename DataTypes::Coord& TTriangle<DataTypes>::p1Free() const { return (*this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue())[(*(this->model->triangles))[this->index][0]]; } +inline const typename DataTypes::Coord& TTriangle<DataTypes>::p1Free() const { return this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue()[(*(this->model->triangles))[this->index][0]]; } template<class DataTypes> -inline const typename DataTypes::Coord& TTriangle<DataTypes>::p2Free() const { return (*this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue())[(*(this->model->triangles))[this->index][1]]; } +inline const typename DataTypes::Coord& TTriangle<DataTypes>::p2Free() const { return this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue()[(*(this->model->triangles))[this->index][1]]; } template<class DataTypes> -inline const typename DataTypes::Coord& TTriangle<DataTypes>::p3Free() const { return (*this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue())[(*(this->model->triangles))[this->index][2]]; } +inline const typename DataTypes::Coord& TTriangle<DataTypes>::p3Free() const { return this->model->mstate->read(sofa::core::ConstVecCoordId::freePosition())->getValue()[(*(this->model->triangles))[this->index][2]]; } template<class DataTypes> inline int TTriangle<DataTypes>::p1Index() const { return (*(this->model->triangles))[this->index][0]; }
18 November 2015 at 14:52 #4221HugoKeymasterHi Jean-Nicolas !
Thank you for your patch.
What is your version of SOFA ? I assume a quite recent one, right ?
I will try to reproduce the bug and see why it happens and wasn’t fixed.Thank you again for providing us feedback !
Hugo
18 November 2015 at 16:41 #4260jnbrunetModeratorI just cloned the master branch yesterday, I like to live dangerously 🙂
I did found some others compilation errors, I will list them here to avoid creating a new thread for each.
/home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp: In constructor ‘sofa::gui::qt::RealGUI::RealGUI(const char*, const std::vector<std::basic_string <char>, std::allocator<std::basic_string <char> > >&)’: /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp:407:5: error: ‘gridLayout’ was not declared in this scope gridLayout->addWidget(interactionButton, 3, 0, 1, 1); ^ /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp: In constructor ‘sofa::gui::qt::RealGUI::RealGUI(const char*, const std::vector<std::basic_string <char>, std::allocator<std::basic_string <char> > >&)’: /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp:411:82: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’ interactionButton->setText(QApplication::translate("GUI", "&Interaction", 0, QApplication::UnicodeUTF8)); ^ /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp:412:79: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’ interactionButton->setShortcut(QApplication::translate("GUI", "Alt+i", 0, QApplication::UnicodeUTF8)); ^ /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp:414:116: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’ interactionButton->setProperty("toolTip", QVariant(QApplication::translate("GUI", "Start interaction mode", 0, QApplication::UnicodeUTF8))); ^ /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp: In member function ‘virtual void sofa::gui::qt::RealGUI::interactionGUI(bool)’: /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp:1987:86: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’ interactionButton->setText(QApplication::translate("GUI", "ESC to qu&it", 0, QApplication::UnicodeUTF8)); ^ /home/nic/sofa/applications/sofa/gui/qt/RealGUI.cpp:1998:86: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’ interactionButton->setText(QApplication::translate("GUI", "&Interaction", 0, QApplication::UnicodeUTF8));
Here I didn’t really know which layout use since the code seems to have change a lot (you will need SOFA_GUI_INTERACTION to reproduce the compilation error). Also in Qt5 QApplication::UnicodeUTF8 doesn’t exists anymore (seems that they only support UTF8, no need to specify it). Here is my patch (I wrote this very quickly to make it work before going to bed, you may want to verify the Qt version in a clean patch)
diff --git a/applications/sofa/gui/qt/RealGUI.cpp b/applications/sofa/gui/qt/RealGUI.cpp index cd34a95..41a7ac6 100644 --- a/applications/sofa/gui/qt/RealGUI.cpp +++ b/applications/sofa/gui/qt/RealGUI.cpp @@ -404,14 +404,14 @@ RealGUI::RealGUI ( const char* viewername, const std::vector<std::string>& optio interactionButton->setCheckable(true); interactionButton->setStyleSheet("background-color: cyan;"); - gridLayout->addWidget(interactionButton, 3, 0, 1, 1); - gridLayout->removeWidget(screenshotButton); - gridLayout->addWidget(screenshotButton, 3, 1, 1,1); + gridLayout1->addWidget(interactionButton, 3, 0, 1, 1); + gridLayout1->removeWidget(screenshotButton); + gridLayout1->addWidget(screenshotButton, 3, 1, 1,1); - interactionButton->setText(QApplication::translate("GUI", "&Interaction", 0, QApplication::UnicodeUTF8)); - interactionButton->setShortcut(QApplication::translate("GUI", "Alt+i", 0, QApplication::UnicodeUTF8)); + interactionButton->setText(QApplication::translate("GUI", "&Interaction", 0)); + interactionButton->setShortcut(QApplication::translate("GUI", "Alt+i", 0)); #ifndef QT_NO_TOOLTIP - interactionButton->setProperty("toolTip", QVariant(QApplication::translate("GUI", "Start interaction mode", 0, QApplication::UnicodeUTF8))); + interactionButton->setProperty("toolTip", QVariant(QApplication::translate("GUI", "Start interaction mode", 0))); #endif connect ( interactionButton, SIGNAL ( toggled ( bool ) ), this , SLOT ( interactionGUI ( bool ) ) ); @@ -1984,7 +1984,7 @@ void RealGUI::interactionGUI ( bool value ) if(value) { - interactionButton->setText(QApplication::translate("GUI", "ESC to qu&it", 0, QApplication::UnicodeUTF8)); + interactionButton->setText(QApplication::translate("GUI", "ESC to qu&it", 0)); this->grabMouse(); this->grabKeyboard(); this->setMouseTracking(true); @@ -1995,7 +1995,7 @@ void RealGUI::interactionGUI ( bool value ) } else { - interactionButton->setText(QApplication::translate("GUI", "&Interaction", 0, QApplication::UnicodeUTF8)); + interactionButton->setText(QApplication::translate("GUI", "&Interaction", 0)); this->releaseKeyboard(); this->releaseMouse(); this->setMouseTracking(false);
Finally, the tutorials houseOfCards, compositeObject and chainHybrid breaks with glut:
/home/nic/sofa/applications/tutorials/houseOfCards/houseOfCards.cpp: In function ‘int main(int, char**)’: /home/nic/sofa/applications/tutorials/houseOfCards/houseOfCards.cpp:197:24: error: ‘glutInit’ was not declared in this scope glutInit(&argc,argv); ^ /home/nic/sofa/applications/tutorials/compositeObject/compositeObject.cpp: In function ‘int main(int, char**)’: /home/nic/sofa/applications/tutorials/compositeObject/compositeObject.cpp:247:24: error: ‘glutInit’ was not declared in this scope glutInit(&argc,argv); ^ /home/nic/sofa/applications/tutorials/chainHybrid/chainHybrid.cpp: In function ‘int main(int, char**)’: /home/nic/sofa/applications/tutorials/chainHybrid/chainHybrid.cpp:229:24: error: ‘glutInit’ was not declared in this scope glutInit(&argc,argv);
I fixed it this way
diff --git a/applications/tutorials/chainHybrid/chainHybrid.cpp b/applications/tutorials/chainHybrid/chainHybrid.cpp index f7a66f9..9bdd11d 100644 --- a/applications/tutorials/chainHybrid/chainHybrid.cpp +++ b/applications/tutorials/chainHybrid/chainHybrid.cpp @@ -46,6 +46,7 @@ #include <sofabasetopology/MeshTopology.h> #include <sofabasetopology/RegularGridTopology.h> +#include <gl/glut.h> // --------------------------------------------------------------------- // --- diff --git a/applications/tutorials/compositeObject/compositeObject.cpp b/applications/tutorials/compositeObject/compositeObject.cpp index 35cdfb1..5a34961 100644 --- a/applications/tutorials/compositeObject/compositeObject.cpp +++ b/applications/tutorials/compositeObject/compositeObject.cpp @@ -61,7 +61,7 @@ #include <utility> - +#include <gl/glut.h> using namespace sofa; using namespace sofa::helper; diff --git a/applications/tutorials/houseOfCards/houseOfCards.cpp b/applications/tutorials/houseOfCards/houseOfCards.cpp index 004cec4..33eb148 100644 --- a/applications/tutorials/houseOfCards/houseOfCards.cpp +++ b/applications/tutorials/houseOfCards/houseOfCards.cpp @@ -50,6 +50,7 @@ //Using double by default, if you have SOFA_FLOAT in use in you sofa-default.cfg, then it will be FLOAT. #include <sofa/component/typedef/Sofa_typedef.h> +#include <gl/glut.h> // --------------------------------------------------------------------- // --- // ---------------------------------------------------------------------
Like I said, I wrote those patch very quickly to make it work on my workstation. I’m very new with the sofa framework, I didn’t find any place to submit patches. If you guys have a place where we can submit pull requests, I would be happy to work a clean patch.
Have a nice day!
9 December 2015 at 17:22 #4829GuillaumeKeymasterHi Jean-Nicolas,
Thank you for your fix 🙂
Unfornately we don’t have such a submission platform for now.
Meanwhile, all your contributions are still very welcome on the forum !We are proud to have active users like you and we are preparing multiple ways to better involve our community, so stay tuned 🙂
Regards,
Guillaume.10 December 2015 at 09:18 #4843HugoKeymasterHi Jean-Nicolas,
Thanks a lot for your feedback.
We are working on allowing any user of the community to make pull request. Today, this isn’t allowed by the gForge that we are using. This will change very soon.We will let you know when pull-request will be available on the website.
Best,
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.