473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

error C2512: no appropriate default constructor

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*>(_un managedObject)->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?
Nov 17 '05 #1
0 1938

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ook | last post by:
Here is my code, can some kind soul tell me what I'm doing wrong, or why I get this compile error, and maybe what to do to prevent it? I think I must be missing some fundamental concept here, or...
4
by: Steve Long | last post by:
Hello, I hope this is the right group to post this to. I'm trying to serialize a class I've written and I'd like to be able to serialze to both binary and xml formats. Binary serialization is...
5
by: Julian | last post by:
I have this piece of code that is working fine in VC6... but when i tried to compile the same code in VC++.NET, I am getting this error : error C2512: 'std::basic_ostream<_Elem,_Traits>' : no...
3
by: denis_browne | last post by:
When writing the following code: class Base { Base(const Base &rhs) {} ~Base(); }; void f() { Base b;
3
by: Sabiyur | last post by:
Hi All, While compiling the dll, I am getting the below error. "error C2512: 'basic_ostream<char,struct std::char_traits<char' : no appropriate default constructor available" The error is...
6
by: Pierre Couderc | last post by:
What do I do wrong? class CTest { public: CTest(int uu); }; void ttt() {
2
by: subramanian | last post by:
Consider the following program: #include <iostream> #include <string> class Member { int x; int y; public: Member(int argx, int argy);
2
by: desktop | last post by:
I get this error when I run my program: red_black_tree.cpp:188: error: no matching function for call to ‘std::less<MyObj<int::less(MyObj<int>&, MyObj<int>&)’...
22
by: clicwar | last post by:
A simple program with operator overloading and copy constructor: #include <iostream> #include <string> using namespace std; class Vector { private: float x,y; public: Vector(float u, float...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.