Hi Rostilav,

that did work thanks a lot. I already had MITK_USE_Boost enabled, but
didn't add 'filesystem' to MITK_USE_Boost_LIBRARIES. Now I'm able to get
the filename and extension from a path :)

Best,
Luis

On 08/10/15 18:44, Rostislav Khlebnikov wrote:
> Hi Luis,
> 
> All you need to do is turn on MITK_USE_Boost and add filesystem to the 
> MITK_USE_Boost_LIBRARIES variable for MITK-build.
> 
> Rostislav.
> 
> On 08/10/2015 17:30, Luis J. Salvatierra wrote:
>> Hi,
>>
>> I'm having a lot of trouble with this, mainly because I'm new to C++.
>> I'm trying to get the filename and extension from a string with this.
>> '''
>> #include <boost/filesystem.hpp>
>>
>> namespace fs = boost::filesystem;
>> using boost::filesystem::path;
>>
>> path p = path(imagePath);
>> std::string filename = p.filename().string();
>> std::string extension = p.stem().string();
>> '''
>>
>> I get this error:
>> '''
>> LJSView.cpp:(.text+0xc304): undefined reference to
>> `boost::filesystem::path::filename() const'
>> LJSView.cpp:(.text+0xc33c): undefined reference to
>> `boost::filesystem::path::stem() const'
>> '''
>>
>> I've tried adding the following to the plugin/project Superbuild.cmake
>> '''
>> # ----------------- Boost ------------------------
>>      -DBOOST_ROOT:PATH=${BOOST_ROOT}
>>      -DBOOST_LIBRARYDIR:PATH=${BOOST_LIBRARYDIR}
>> '''
>>
>> I had to add too the following to the plugin/project CMakeLists.txt
>> '''
>> mitk_create_plugin(
>> ...
>>      PACKAGE_DEPENDS Boost
>> ...
>> )
>> '''
>>
>> But I can't get it to work. Any advice? Thanks :)
>>
>> Regards,
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> mitk-users mailing list
> mitk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mitk-users
> 

-- 
Luis J. Salvatierra
http://www.ljsalvatierra.com
@Luisja_350
Python San Sebastián - ACPySS

------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to