vsg-dev/vsgXchange

osg/OSG.cpp does not compile on Windows (Visual Studio)

Closed this issue · 4 comments

The following line in vsgXchange/src/osg/OSG.cpp
osgDB::ReaderWriter::ReadResult rr = osgDB::Registry::instance()->readObject(filename, osg_options.get());

produces an error message with VisualStudio (2017, 2019, 2022):

vsgXchange\src\osg\OSG.cpp(186,109): error C2664: "osgDB::ReaderWriter::ReadResult osgDB::Registry::readObject(const std::string &,const osgDB::Options *,bool)" :
Conversion of argument 1 from "const vsg::Path" to "const std::string &" not possible. 

Changed it similar as was done in assimp.cpp (add .string()):
osgDB::ReaderWriter::ReadResult rr = osgDB::Registry::instance()->readObject(filename.string(), osg_options.get());

Also the copying of vsgOptions to osgOptions does not work:
osg_options->getDatabasePathList().insert(osg_options->getDatabasePathList().end(), options->paths.begin(), options->paths.end());

Changed it to using a loop and the string() method:

for( auto itr = options->paths.begin(); itr != options->paths.end(); ++itr)
    osg_options->getDatabasePathList().insert(osg_options->getDatabasePathList().end(), (*itr).string());

Although this module now compiles, vsgXchange::OSG does not show up in the feature list of vsgconv --features.
Any hints, why it does not show up?

OSG.zip
`

Thanks for the fixes, now merged and submitted to vsgXchange master.

W.r.t vsgconv --features not listing OSG, just tried it under Linux and it's working as expected for me. You can also list just the OSG loader via:

vsgconv --features vsgXchange::OSG

Could you try this and see what happens?

OSG features are now displayed, if keeping the plugin DLL's in the directory osgPlugins-3.6.5.
In my first approach, I copied the plugin DLL's into the directory where the osg DLL's reside.

I'm happy now, yes.
I get all compiled features in output of vsgconv --features except vsgGIS/gdal, which I have not tested yet.

Two small hints.
In the vsgXchange Readme file there are the following statements:

Requires Assimp 5.x depedency.
Requires OpenSceneGraph 3.x depedency.

while the associated build_vars.cmake files limit Assimp to versions 5.0 and 5.1, and OSG to version 3.6.