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_ptr<osg::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

Reply via email to