error C2512: no appropriate default constructor
- From: "WithPit" <WithPit@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 May 2005 02:07:04 -0700
I have some problems with the instantiating new objects. For example I have
the following code
//Headerfile (Texture1D.h>
#pragma once
#using <mscorlib.dll>
#include <osg/Texture1D>
#include <osg/Texture>
#include <managedosg/Texture.h>
namespace ManagedOsg
{
public __gc class Object;
public __gc class Image;
public __gc class Texture1DSubloadCallback;
public __gc class Texture1D : public ManagedOsg::Texture
{
public:
Texture1D(osg::Texture1D* unmanagedObject);
Texture1D(){};
ManagedOsg::Image *getImage();
};
}
//Cppcode (Texture1D.cpp>
#include <managedOsg/Texture1D.h>
ManagedOsg::Texture1D::Texture1D(osg::Texture1D* unmanagedObject)
{
_unmanagedObject = unmanagedObject;
}
ManagedOsg::Image *ManagedOsg::Texture1D::getImage()
{
return new
ManagedOsg::Image(static_cast<osg::Texture1D*>(_unmanagedObject)->getImage());
}
When i compile this i get an error C2512: 'ManagedOsg::Image' : no
appropriate default constructor available. When i look at the
ManagedOsg::Image class i have the following code
//Header file
#pragma once
#using <mscorlib.dll>
#include <osg/Image>
#include <osg/Object>
#include <managedosg/Object.h>
namespace ManagedOsg
{
public __gc class Object;
public __gc class Image : public ManagedOsg::Object
{
public:
Image(osg::Image* unmanagedObject);
Image();
};
}
//Cppfile
#include <managedOsg/Image.h>
ManagedOsg::Image::Image()
{
_unmanagedObject = new osg::Image();
}
ManagedOsg::Image::Image(osg::Image* unmanagedObject)
{
_unmanagedObject = unmanagedObject;
}
The image.cpp compiles without any error. When I change the getImage()
method to for example
return new ManagedOsg::Image()
the same eroor is happening. Compiling goes correctly if i return an NULL
value so i no for sure that the problem is inside the Texture1D class. And it
has also nothing to do with the unmanaged argument because i get the same
error without an argument.
How can help me solving this problem?
.
- Prev by Date: Re: GetParent
- Next by Date: Re: rename function
- Previous by thread: rename function
- Next by thread: how to trap divide-by-zero
- Index(es):
Relevant Pages
|