473,320 Members | 1,853 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,320 software developers and data experts.

Error : Visual 2005 is more C++ compliant and my projct doesn't compile


Hi,

I found a project called ACF and that implemnts .NET classes into C++.
The issue come from the fact that it was developped under VS 2003
and under 2005 I get the following

c:\acf\src\corlib\acf\acfbase.h(364) : error C2299:
'Acf::RefPtr<T>::RefPtr' : behavior change: an explicit specialization
cannot be a copy constructor or copy assignment operator

template <class T> // T: reference types (object, interface)
class RefPtr
{
// Fields
private:
T* _p;

// Constructor & Destructor
public:
RefPtr() : _p(null)
{
}
RefPtr(T* p) : _p(p)
{
_AddRef();
}
// Templated version to allow pBase = pDerived
template <class U>
RefPtr(const RefPtr<U>& src) : _p((U*)src)
{
_AddRef();
}

// METHOD BELOW DO NOT COMPILE
template <>
RefPtr(const RefPtr<T>& src) : _p((T*)src)
{
_AddRef();
}

~RefPtr()
{
_Release();
}
.....
};
How can I fix that ?
Jun 13 '06 #1
1 1959

Vincent RICHOMME wrote:
Hi,

I found a project called ACF and that implemnts .NET classes into C++.
The issue come from the fact that it was developped under VS 2003
and under 2005 I get the following

c:\acf\src\corlib\acf\acfbase.h(364) : error C2299:
'Acf::RefPtr<T>::RefPtr' : behavior change: an explicit specialization
cannot be a copy constructor or copy assignment operator

template <class T> // T: reference types (object, interface)
class RefPtr
{
// Fields
private:
T* _p;

// Constructor & Destructor
public:
RefPtr() : _p(null)
{
}
RefPtr(T* p) : _p(p)
{
_AddRef();
}
// Templated version to allow pBase = pDerived
template <class U>
RefPtr(const RefPtr<U>& src) : _p((U*)src)
{
_AddRef();
}

// METHOD BELOW DO NOT COMPILE
template <>
RefPtr(const RefPtr<T>& src) : _p((T*)src)
Try just this (no "template<>"):

RefPtr(const RefPtr& src) : _p((T*)src)

{
_AddRef();
}

~RefPtr()
{
_Release();
}
....
};
How can I fix that ?


Cheers! --M

Jun 13 '06 #2

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

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
12
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions...
3
by: John | last post by:
Hi, I am working on a legacy code. Following is a line of the code which complies with Visual C++.NET 2003 but not with Visual C++ 2005: for ( int i = 0; i < (const)(X.size()); i++ ) {}// X is...
11
by: Niels Dekker - no reply address | last post by:
The following attempt to pass my template "Base" as a template template argument was rejected by Microsoft VC++ 8.0 (2005), while it still works on VC++ 7.1 (2003). Is it correct C++? And is...
33
by: Martin Jørgensen | last post by:
Hi, In continuation of the thread I made "perhaps a stack problem? Long calculations - strange error?", I think I now got a "stable" error, meaning that the error always seem to come here now...
23
by: deathtospam | last post by:
A day or two ago, I wrote a quick ASPX page with a CS codebehind using Visual Studio .NET 2005 -- it worked, I saved it and closed the project. Today, I came back to the project, reopened the...
4
by: tofu.captain | last post by:
I'm using Visual Studio .NET 2005 with a C# Web Application project. I have an ASPX page that uses a MasterPage file for a general site layout. That works just fine, but when I run a compile of...
11
by: jakester | last post by:
I am using Visual C++ 2007 to build the code below. I keep getting linkage error. Could someone please tell me what I am doing wrong? The code works until I start using namespace for my objects. ...
1
by: sahilrekhi | last post by:
Hi i am working on a graphical user interface deisgn programme. when i compile the file i i get the following output with the mentioned errors: 1>------ Rebuild All started: Project: guiq,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.