User forums > Using Code::Blocks

Code completion + OGRE

(1/2) > >>

iceberk:
I have the folowing code

--- Code: ---#include "ExampleApplication.h"

class TutorialApplication : public ExampleApplication
{
protected:
public:
    TutorialApplication()
    {
    }

    ~TutorialApplication()
    {
    }
protected:
    void createScene(void)
    {
        mSceneMgr->setAmbientLight(ColourValue(0.7, 1, 1));       
    }
};

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif
{
    // Create application object
    TutorialApplication app;

    try {
        app.go();
    } catch( Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
        fprintf(stderr, "An exception has occured: %s\n",
                e.getFullDescription().c_str());
#endif
    }

    return 0;
}

--- End code ---
When i'm writing "mSceneMgr->"(or "ap."), code completion displays nothing. Why?

OS: Windows XP
Code::Blocks version: svn build rev 3592

Code completion settings:
  Code completion - only "Automatically launch..." checked
  C/C++ parser - all checked
  Symbol browser - only "Automatically expand namespaces" checked

iceberk:
Ok, problem is solved by adding following line :o

--- Code: ---using namespace Ogre;
--- End code ---
I suggest this line should be added to Ogre's template

san:
This may solve the problem for windows users perhaps... but I'm on Ubuntu Linux and the problem still occurs.

mandrav:

--- Quote from: san on February 14, 2007, 12:31:18 pm ---This may solve the problem for windows users perhaps... but I'm on Ubuntu Linux and the problem still occurs.

--- End quote ---

For linux, things are a little different because we use shell scripts to configure the project for Ogre (e.g. "pkg-config --cflags OGRE"). For this reason, the C/C++ parser doesn't know where to find the files.
To help the parser find (and parse) the files, add OGRE's include dir in "Project->Properties->C/C++ parser options". Save your project, close and re-open it and then it should work.

san:
Thanks for the fast reply!

For future reference:
I added this path "/somewhere/ogrenew/OgreMain/include" at the location you suggested and restarted code::blocks. That in combination with the following line makes code completion work!

--- Code: ---using namespace Ogre;
--- End code ---

It would be nice if the Ogre examples also were there for linux (now new users need to modify them by hand).. but other than that I'm very pleased!

Thanks,
San

Navigation

[0] Message Index

[#] Next page

Go to full version