Home › Forum › SOFA › Building SOFA › [SOLVED] SofaBaseTopology/*.h: No such file or directory
Tagged: 64_bits, GCC, Linux_ubuntu, SOFA_1812
- This topic has 6 replies, 2 voices, and was last updated 5 years, 4 months ago by gaetan.
-
AuthorPosts
-
19 June 2019 at 14:39 #13782gaetanBlocked
Hi!
I’m facing a problem while building sofa since I added some files to my project. I downloaded the version 18.12.01 and I still have the same problem :
In my main file .cpp I have :
#include <SofaBaseTopology/TetrahedronSetTopologyContainer.h>
When I try to build, I get SofaBaseTopology/TetrahedronSetTopologyContainer.h : No such file or directorySo I tried to modify the path as :
#include <sofa/../../modules/SofaBaseTopology/TetrahedronSetTopologyContainer.h>
Which works fine, the file is found but then the problems occurs on the dependent files:In TetrahedronSetTopologyContainer.h :
#include <SofaBaseTopology/TriangleSetTopologyContainer.h>
And then the same error..Do you know if there is a way to solve this problem ? Maybe including the path of SofaBaseTopology somewhere in cmake ?
Thank you in advance,
Gaetan19 June 2019 at 19:06 #13790HugoKeymasterHi Gaetan
If I understood correctly, you downloaded the binary version of SOFA v18.12.01. And now you are willing to compile your own plugin separately. Is that it?
Could you describe the way your repositories are arranged? (where are the binaries of SOFA, where is you main.cpp etc)Hugo
20 June 2019 at 10:45 #13799gaetanBlockedHi Hugo, sorry I should have been more precise.
I downloaded the sources of the last stable version (18.12.01), added my plugins (without the file causing the error) and compiled it successfully. Everything works fine but when I add (to the CMakeLists) the file containing this include
#include <SofaBaseTopology/TetrahedronSetTopologyContainer.h>
I get the error
SofaBaseTopology/TetrahedronSetTopologyContainer.h : No such file or directory
Probably the compiler doesn’t find the directory SofaBaseTopology because it works when I modify the path as
#include <sofa/../../modules/SofaBaseTopology/TetrahedronSetTopologyContainer.h>
But I cannot do it for all the SofaBase source files.My plugins are in a separate directory as follow :
sofa/external-plugins/MyPlugins/MyComponentsSource and build of sofa paths are :
sofa/sofa-18.12.01/src
sofa/sofa-18.12.01/buildGaetan
20 June 2019 at 11:14 #13800HugoKeymasterHi @gaetan
thanks for the detailed explanation, it helps. Can you finally post your plugin CMakeLists.txt please?
Hugo
20 June 2019 at 11:41 #13808gaetanBlockedSure, here it is (I removed the unrelated components).
cmake_minimum_required(VERSION 3.1) project(CardiacReduction VERSION 0.1) find_package(SofaFramework REQUIRED) set(HEADER_FILES initCardiacReduction.h config.h # main.h ) set(SOURCE_FILES initCardiacReduction.cpp # main.cpp ) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} SofaCore) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_CARDIACREDUCTION") install(TARGETS CardiacReduction RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
20 June 2019 at 15:26 #13835HugoKeymasterOk, you then have a problem of dependency. Let me explain.
You are including classes contained in the SofaBaseTopology library. As shown in the CheatSheet (not perfectly up to date FYI), the SofaBaseTopology belongs the SofaBase package.
Here is the CMakeLists.txt you need to use:
cmake_minimum_required(VERSION 3.1) project(CardiacReduction VERSION 0.1) find_package(SofaFramework REQUIRED) find_package(SofaBase REQUIRED) set(HEADER_FILES initCardiacReduction.h config.h # main.h ) set(SOURCE_FILES initCardiacReduction.cpp # main.cpp ) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} SofaCore SofaBaseTopology) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_CARDIACREDUCTION") install(TARGETS CardiacReduction RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
Let me know if it helps.
BestHugo
20 June 2019 at 15:54 #13836gaetanBlockedYes it helps a lot thank you that solved the problem!
I also had to add SofaComponentBase in addition to SofaBaseTopology to the target_link_libraries.
Thank you again,
Gaetan
-
AuthorPosts
- You must be logged in to reply to this topic.