OpenSceneGraph
OpenSceneGraph copied to clipboard
osg vcpkg
How right way install osg
with vcpkg
for MSbuild (Visual Studio) apps?
all osg
files in "vcpkg\installed\x64-windows\include\osg" has no extension, so simple:
#include <osg/AnimationPath>
is not work.
I don't use vcpkg, but it's normal for the OSG header files to not have an extension. C/C++ does not require the header files to have an extension, and no extension should work fine. If your build isn't finding the headers it's probably because the include file search paths are not setup to point to your installed OSG location.
Maybe im not install the OSG environment variables?
How do it right for Visual Studio? i think vcpkg
do that yourself.
It turns out that I have problems with the visibility of plugins.
Error reading file cessna.osg: read error (Could not find plugin to read objects from file "cessna.osg".)
```
I tried to put `osgdb_osg.dll` in project directory, in build directory (x64 too), moved plugins from` {VCPKG_PATH}/x64-windows/tools/osgPlugins-3.$.$` to `{VCPKG_PATH}/x64-windows/lib/osgPlugins-3.$.$`, but i have no vision for it.
missclick closed :)
That sounds like the problem. Here are two solutions to try:
- Add your OSG bin folder to the windows PATH environment variable. You can do this either by the windows UI or command prompt.
The OSG bin folder should contain the main OSG dlls and an osgPlugins folder, for example:
- Copy the contents of the OSG bin folder to your application's binaries folder. This is the preferred solution for installed applications (i.e to be used by end-users) but not so good for development because it requires duplicating files.
- Done. nothing happend, also i add env var like
OSG_BIN_PATH
,OSG_INCLUDE_PATH
,OSG_LIB_PATH
too. - Osg
*.dlls
copy right into x64 app folder, vcpkg already do that, but not plugins, copy plugins dir make no result.
I Check .exe
dll with Dependechies tools, and nothing relust for plugins too.
i can try install osg with cmake, but is strange)
Ok im reinstall it from cmd - vcpkg install osg[core,plugins]:x64-windows --recursive
and now i have several *.exe
files like osgviewer.exe
, into {VCPKG dir installed}/windows-x64/tools/osg/
. Interesting, but osgviewer.exe
work ( some warnings apply, but still executable), before that, im check that .exe with Dependencies tool
and miss some dlls like osgViewer.dll, osgGA.dll, osgDB.dll
and other wich placed into /bin
folder. after that i add /bin
folder to the Path
env again (as you advised). After this thing i conduct for it, in Dependencies tool
so all dll's is found, and *.exe being work.
But simple code like
#include <windows.h>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <iostream>
int main(int argc, char **argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("cessna.osg");
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
return viewer.run();
}
again drop the message:
Error reading file cessna.osg: read error (Could not find plugin to read objects from file "cessna.osg".)
whyyy
I think you should add your OSG bin folder to the windows PATH environment variable, like this: