Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:03:28+00:00 2026-06-10T04:03:28+00:00

I am working on an Ogre project and I am getting some issues with

  • 0

I am working on an Ogre project and I am getting some issues with Xcode.
Whenever I make the scene manager pointer static, the program does not compile and I get the following error:

Undefined symbols for architecture x86_64:
  "OgreInit::sceneManager", referenced from:
      OgreInit::initOgre() in OgreInit.o
      OgreInit::initScene() in OgreInit.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Here is my OgreInit.cpp

#include <iostream>
#include <exception>
#include <string>

#include "OGRE/Ogre.h"
#include "OGRE/OgreException.h"
#include "OGRE/OgreRoot.h"
#include "OGRE/OgreResourceManager.h"
#include "OGRE/OgreMath.h"

#include "MainLoop.h"
#include "WorkingDirectory.h"
#include "OgreInit.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include "macUtils.h"
#endif

OgreInit::OgreInit()
{
    mainLoop = new MainLoop();
    mainLoop->startLoop();
    initOgre();
    initScene();
}

void OgreInit::initOgre()
{
    root = new Ogre::Root(WorkingDirectory::getResourcesDirectory() + "plugins.cfg", WorkingDirectory::getResourcesDirectory() + "window.cfg", "");
    root->showConfigDialog();

    window = root->initialise(true);
    sceneManager = root->createSceneManager(Ogre::ST_GENERIC);

    camera = sceneManager->createCamera("mainCamera");
    camera->setNearClipDistance(0.1);
    camera->setFarClipDistance(300);
    camera->setPosition(0, 0, 80);
    //camera->lookAt(Ogre::Vector3::ZERO);

    cameraNode = sceneManager->getRootSceneNode()->createChildSceneNode();
    cameraNode->attachObject(camera);

    viewport = window->addViewport(camera);
    viewport->setClearEveryFrame(true);
    viewport->setAutoUpdated(true);
    viewport->setBackgroundColour(Ogre::ColourValue(1, 0, 1));

    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(WorkingDirectory::getModelDirectory(), "FileSystem");
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}

void OgreInit::initScene()
{
    sceneManager->setAmbientLight(Ogre::ColourValue(0.5f, 0.5f, 0.5f));

    Ogre::Entity *ogreHead = sceneManager->createEntity("Head", "ogrehead.mesh");

    Ogre::SceneNode *headNode = sceneManager->getRootSceneNode()->createChildSceneNode("HeadNode");
    headNode->attachObject(ogreHead);
    headNode->rotate(*new Ogre::Vector3(0, 1, 0), (Ogre::Radian)Ogre::Math::DegreesToRadians(90));

    Ogre::Light *light = sceneManager->createLight("MainLight");
    light->setPosition(20.0f, 80.0f, 50.0f);
}

//init resources before scene :! and translate before attaching

OgreInit::~OgreInit()
{

}

And of course the header:

#ifndef __OgreTest__OgreInit__
#define __OgreTest__OgreInit__

#include <iostream>
#include <string>
#include <memory>

#include "OGRE/Ogre.h"
#include "MainLoop.h"

class OgreInit
{
public:
    OgreInit();
    ~OgreInit();
private:
    void initOgre();
    void initScene();
    MainLoop *mainLoop;
    Ogre::Root *root;
    Ogre::RenderWindow *window;
    static Ogre::SceneManager *sceneManager;
    Ogre::Viewport *viewport;
    Ogre::Camera *camera;
    Ogre::SceneNode *cameraNode;
};

#endif /* defined(__OgreTest__OgreInit__) */

I have seen this issue on Stackoverflow quite often, but usually it happened because some required libraries were not included. I don’t think that is the issue here because I am not getting any errors if I change: static Ogre::SceneManager *sceneManager; to: Ogre::SceneManager *sceneManager;

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:03:30+00:00Added an answer on June 10, 2026 at 4:03 am

    As well as declaring it in your header file, you need to actually define the sceneManager in your implementation file:

    ...
    #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    #include "macUtils.h"
    #endif
    
    Ogre::SceneManager *OgreInit::sceneManager = 0;
    
    OgreInit::OgreInit()
    {
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on ogre project by using C++. Normally I use viewport:setbackground() but this
Working on the problems on Project Euler to try to learn Clojure. I'm on
Working on game where plates will be falling from top to bottom. Some plates
Working on a project using Entity Framework (4.3.1.0). I'm trying to figure out how
Working on calling a C function from my asm project. I'm trying to push
Working on an old Kohana 2 project and I want to link two models.
Its a little strange. Ok so I am working with OGRE game engine which
working on xcode I realized that if I create a non-void method, I call
Working on getting the Mercurial Source Control installed and working with Lotus Domino Designer
Working on a project where I need to add points to an array. Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.