- This topic has 3 replies, 3 voices, and was last updated 4 years, 9 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] Import plugin in cpp
Tagged: 64_bits, cpp plugins, Linux_ubuntu, Plugin_other, SOFA_1906
Hi all,
I have encountered a problem with importing plugins in a cpp scene. I have tried:
simpleapi::importPlugin("SofaOpenglVisual");
and
sofa::helper:system::PluginManager::get_instance().loadPlugin("SofaOpengVisual");
but both ways produce the same output:
Plugin not found: "SofaOpenglVisual"
Here is a snippet of CMakeLists.txt:
cmake_minimum_required(VERSION 3.1)
project(hystsim)
find_package(SofaGui)
find_package(SofaSimulation REQUIRED)
find_package(SofaOpenglVisual REQUIRED)
find_package(CImgPlugin REQUIRED)
add_executable(${PROJECT_NAME} main.cpp scenemanager.cpp)
target_link_libraries(${PROJECT_NAME} SofaGuiMain SofaSimulationGraph SofaOpenglVisual CImgPlugin)
sofa lib dir is also added to LD_LIBRARY_PATH without any results. Could you tell what might be missing?
Regards,
Vlad
Hey @bobiko
Great to see you again!
Hope everything is fine despite Covid19.
Which version are you using of SOFA?
– binary? which release?
– source? which release/branch/version?
Can you find the location of the libSofaOpenglVisual.so yourself?
Best,
Hugo
Hey @bobiko,
The Sofa’s libraries cannot automatically know what is your Sofa’s installation path, hence where the core plugins are located.
You can help them find it with the environment variable “SOFA_ROOT”, for example, if you built Sofa in the directory /home/bobiko/sofa/build:
$ export SOFA_ROOT=/home/bobiko/sofa/build
$ ./hystsim
Or by manually add the Sofa’s library path to the Plugin repository in your program:
main.cpp
sofa::helper::system::PluginRepository.addFirstPath("/home/bobiko/sofa/build/lib");
sofa::helper:system::PluginManager::get_instance().loadPlugin("SofaOpengVisual");
Hope that helped
Hi guys,
Thank you for the tip, it worked for me!
Regards,
Vlad
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.