Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid use of template name without argument list

Tags:

c++

templates

I'm attempting to do two things which are giving me problems:

1) typedef an std::vector
2) declare a std::auto_ptr

Both of these are giving me the error "invalid use of template-name 'std::vector/auto_ptr' without an argument list". Here's my headers where the error is being caused:

ResourceLocationDefinition.h

// ResourceLocationDefinition contains the information needed
// by Ogre to load an external resource.

#ifndef RESOURCELOCATIONDEFINITION_H_
#define RESOURCELOCATIONDEFINITION_H_

#include "string"
#include "vector"

struct ResourceLocationDefinition
{
    ResourceLocationDefinition(std::string type, std::string location, std::string section) :
        type(type),
        location(location),
        section(section)
    {
    }

    ~ResourceLocationDefinition() {}
    std::string type;
    std::string location;
    std::string section;
};

typedef std::vector ResourceLocationDefinitionVector;

#endif

EngineManager.h

#ifndef ENGINEMANAGER_H_
#define ENGINEMANAGER_H_

#include "memory"
#include "string"
#include "map"

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

#include "ResourceLocationDefinition.h"

// define this to make life a little easier
#define ENGINEMANAGER OgreEngineManager::Instance()

// All OGRE objects are in the Ogre namespace.
using namespace Ogre;

// Manages the OGRE engine.
class OgreEngineManager :
    public WindowEventListener,
    public FrameListener
{
public:
    // Bunch of unrelated stuff to the problem

protected:
    // Constructor. Initialises variables.
    OgreEngineManager();

    // Load resources from config file.
    void SetupResources();

    // Display config dialog box to prompt for graphics options.
    bool Configure();

    // Setup input devices.
    void SetupInputDevices();

    // OGRE Root
    std::auto_ptr root;

    // Default OGRE Camera
    Camera* genericCamera;

    // OGRE RenderWIndow
    RenderWindow* window;

    // Flag indicating if the rendering loop is still running
    bool engineManagerRunning;

    // Resource locations
    ResourceLocationDefinitionVector  resourceLocationDefinitionVector;

    // OIS Input devices
    OIS::InputManager*      mInputManager;
    OIS::Mouse*             mMouse;
    OIS::Keyboard*          mKeyboard;
};

#endif /* ENGINEMANAGER_H_ */

1 Answers

When using templates, you have to provide template parameters, for your vector, you probably want to do something like this:

typedef std::vector<ResourceLocationDefinition> ResourceLocationDefinitionVector;

Meaning that your vector references ResourceLocationDefinition object instances.

and for your auto_ptr something like this:

std::auto_ptr<Root> root;

I believe you want an Ogre::Root pointer there right?

like image 62
imreal Avatar answered Nov 03 '25 08:11

imreal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!