Re: [osg-users] OpenSceneGraph for Beginners tutorial help requested
Thanks for the feed back. I tried the new CMakeList.txt file provided without much luck. I changed it back and then double checked that I was using the release version (the version without the d's at the end) and that is correct. I have the precompiled version for win x64 and my environment variable OSG_ROOT points to c:\osg My bin lib and include files are c:\osg\bin, c:\osg\lib, and c:\osg\include respectively. Now I am getting a new error however. Code: 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_stringchar,struct std::char_traitschar,class std::allocatorchar const ,class osgDB::Options const *) (__imp_?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBVOptions@1@@Z) referenced in function class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_stringchar,struct std::char_traitschar,class std::allocatorchar const ) (?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: class osgDB::Options * __thiscall osgDB::Registry::getOptions(void) (__imp_?getOptions@Registry@osgDB@@QAEPAVOptions@2@XZ) referenced in function class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_stringchar,struct std::char_traitschar,class std::allocatorchar const ) (?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: static class osgDB::Registry * __cdecl osgDB::Registry::instance(bool) (__imp_?instance@Registry@osgDB@@SAPAV12@_N@Z) referenced in function class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_stringchar,struct std::char_traitschar,class std::allocatorchar const ) (?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: unsigned int __thiscall OpenThreads::Atomic::operator++(void) (__imp_??EAtomic@OpenThreads@@QAEIXZ) referenced in function public: __thiscall osg::ref_ptrclass osg::Node::ref_ptrclass osg::Node(class osg::Node *) (??0?$ref_ptr@VNode@osg@@@osg@@QAE@PAVNode@1@@Z) 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: int __thiscall osg::Referenced::unref(void)const (__imp_?unref@Referenced@osg@@QBEHXZ) referenced in function public: __thiscall osg::ref_ptrclass osg::Node::~ref_ptrclass osg::Node(void) (??1?$ref_ptr@VNode@osg@@@osg@@QAE@XZ) 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: void __thiscall osgViewer::Viewer::`vbase destructor'(void) (__imp_??_DViewer@osgViewer@@QAEXXZ) referenced in function __unwindfunclet$_main$0 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) protected: virtual __thiscall osg::Object::~Object(void) (__imp_??1Object@osg@@MAE@XZ) referenced in function _main 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: virtual __thiscall osgViewer::Viewer::~Viewer(void) (__imp_??1Viewer@osgViewer@@UAE@XZ) referenced in function _main 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osgViewer::Viewer::run(void) (__imp_?run@Viewer@osgViewer@@UAEHXZ) referenced in function _main 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osgViewer::Viewer::setSceneData(class osg::Node *) (__imp_?setSceneData@Viewer@osgViewer@@UAEXPAVNode@osg@@@Z) referenced in function _main 2main.obj : error LNK2019: unresolved external symbol __declspec(dllimport) public: __thiscall osgViewer::Viewer::Viewer(void) (__imp_??0Viewer@osgViewer@@QAE@XZ) referenced in function _main Do I need a special envrionment variable for the dll's? I've tried to put them into the Working Directory under Debugging in the properties but that doesn't help. Cheers, Seth[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50902#50902 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenSceneGraph for Beginners tutorial help requested
Hi, I've been working with the OSG Beginners book. I am trying to get the first program to run but I continually get a bad alloc error: Code: Microsoft C++ exception: std::bad_alloc at memory location 0x00a1d4f0.. The break point is: Code: inline osg::Node* readNodeFile(const std::string filename) { return readNodeFile(filename,Registry::instance()-getOptions()); } And the following is my code: Code: #include osgDB/ReadFile #include osgViewer/Viewer int main( int argc, char** argv ) { osg::ref_ptrosg::Node root = osgDB::readNodeFile(c:\\osg\\data\\cessna.osg); osgViewer::Viewer viewer; viewer.setSceneData( root.get() ); return viewer.run(); } Any hints would be fantastic. Thank you! Cheers, Seth -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50843#50843 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph for Beginners tutorial help requested
Hey, I've encountered the same problem some time ago. The problem was the macro in the CMakeLists.txt. On my system it hast to be _INCLUDE_DIRS and _LIBRARIES. Try this osg-cmake project setup: cmake_minimum_required(VERSION 2.8) project(MyProject) set(target MyProject) find_package(OpenSceneGraph REQUIRED osgAnimation osgDB osgGA osgText osgUtil osgViewer osgShadow osgParticle ) set(sources src/main.cpp ) include_directories( ${OPENSCENEGRAPH_INCLUDE_DIRS} ) add_executable(${target} ${sources}) target_link_libraries(${target} ${OSG_LIBRARIES} ${OSGANIMATION_LIBRARIES} ${OSGDB_LIBRARIES} ${OSGGA_LIBRARIES} ${OSGTEXT_LIBRARIES} ${OSGUTIL_LIBRARIES} ${OSGVIEWER_LIBRARIES} ${OPENTHREADS_LIBRARIES} ${OSGSHADOW_LIBRARIES} ${OSGPARTICLE_LIBRARIES} ) Also if you built osg from source and ran the install target, make sure your OSG_DIR env variable point to your install directory specified in the cmake-gui (e.g. c:/lib/osg/install), otherwise cmake could include the wrong header files. Hope this helps. Von: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] im Auftrag von Seth Hays [hays@gmail.com] Gesendet: Montag, 29. Oktober 2012 02:47 An: osg-users@lists.openscenegraph.org Betreff: [osg-users] OpenSceneGraph for Beginners tutorial help requested Hi, I've been working with the OSG Beginners book. I am trying to get the first program to run but I continually get a bad alloc error: Code: Microsoft C++ exception: std::bad_alloc at memory location 0x00a1d4f0.. The break point is: Code: inline osg::Node* readNodeFile(const std::string filename) { return readNodeFile(filename,Registry::instance()-getOptions()); } And the following is my code: Code: #include osgDB/ReadFile #include osgViewer/Viewer int main( int argc, char** argv ) { osg::ref_ptrosg::Node root = osgDB::readNodeFile(c:\\osg\\data\\cessna.osg); osgViewer::Viewer viewer; viewer.setSceneData( root.get() ); return viewer.run(); } Any hints would be fantastic. Thank you! Cheers, Seth -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50843#50843 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph for Beginners tutorial help requested
Another thing to check is make sure you're not mixing debug version of OSG with a release version of your app and vice versa. They must be the same. I've had readNodeFile() fail as below when I accidently linked my release built app with debug OSG... -Shayne -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Seth Hays Sent: Sunday, October 28, 2012 7:48 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] OpenSceneGraph for Beginners tutorial help requested Hi, I've been working with the OSG Beginners book. I am trying to get the first program to run but I continually get a bad alloc error: Code: Microsoft C++ exception: std::bad_alloc at memory location 0x00a1d4f0.. The break point is: Code: inline osg::Node* readNodeFile(const std::string filename) { return readNodeFile(filename,Registry::instance()-getOptions()); } And the following is my code: Code: #include osgDB/ReadFile #include osgViewer/Viewer int main( int argc, char** argv ) { osg::ref_ptrosg::Node root = osgDB::readNodeFile(c:\\osg\\data\\cessna.osg); osgViewer::Viewer viewer; viewer.setSceneData( root.get() ); return viewer.run(); } Any hints would be fantastic. Thank you! Cheers, Seth -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50843#50843 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org