Migration from VC++ 6.0

L

Lei Jiang

I am upgrading our system from VC++ 6.0 to VC++7.0, and found some code
can't be compiled, for example :


template<class T>
class QMemArray<T>
{
public :
......
int count();
}

template<class T>
class Array : public QMemArray<T>
{
......
}

#if _MSC_VER > 1300
template <> class Array<ToolBarInfo> // Partial Implementation to make
the compiler feel good
{
};
#endif

class APPBASE_EXPORT ToolBarTable : public Array<ToolBarInfo>
{
......
}

When I use class ToolBarTable, the compiler report that it can't find the
method "count()" of the class ToolBarTable. But it works in VC++ 6.0.

Another problem is that I have to use that "partial implementation"
otherwise the compiler will ask me to provider some operator (such as "==")
implementation of structure ToolBarInfo. Is there any method to avoid that?

Thanks!
 
J

Jianwei Sun

see inline..
Lei Jiang said:
I am upgrading our system from VC++ 6.0 to VC++7.0, and found some code
can't be compiled, for example :


template<class T>
class QMemArray<T>
{
public :
......
int count();
}

template<class T>
class Array : public QMemArray<T>
{
......
}

#if _MSC_VER > 1300
template <> class Array<ToolBarInfo> // Partial Implementation to make
the compiler feel good
{
};
#endif

class APPBASE_EXPORT ToolBarTable : public Array<ToolBarInfo>
{
......
}

When I use class ToolBarTable, the compiler report that it can't find the
method "count()" of the class ToolBarTable. But it works in VC++ 6.0.

[
In VC++ 6.0 , the code between
#if _MSC_VER > 1300 (it stands for VC.Net)
template <> class Array<ToolBarInfo> // Partial Implementation to makethe
compiler feel good
{
};
#endif

is not compiled, so when you declare public Array<ToolBarInfo>, it will
instantiate the first definition
template<class T>
class QMemArray<T> {
public :
......
int count();
}
which has the method count() defined.

While in VS.net , the code between #if _MSC_VER > 1300 .. #endif is
compiled, and when you declare
public Array<ToolBarInfo>, it will go to the closest match, which is the
version between #if _MSC_VER > 1300 .. #endif
and that one doesn't have count()" defined..

]
Another problem is that I have to use that "partial implementation"
otherwise the compiler will ask me to provider some operator (such as "==")
implementation of structure ToolBarInfo. Is there any method to avoid that?
[
I haven't tried that, if you post the whole declaration of the class,
people may give you a better answer..
]
 
L

Lei Jiang

If I removed that partial implementation, the error exists, plus more
errors: the VC7 compiler now ask me to provide the "==" operator of
ToolBarInfo.


Jianwei Sun said:
see inline..
Lei Jiang said:
I am upgrading our system from VC++ 6.0 to VC++7.0, and found some code
can't be compiled, for example :


template<class T>
class QMemArray<T>
{
public :
......
int count();
}

template<class T>
class Array : public QMemArray<T>
{
......
}

#if _MSC_VER > 1300
template <> class Array<ToolBarInfo> // Partial Implementation to make
the compiler feel good
{
};
#endif

class APPBASE_EXPORT ToolBarTable : public Array<ToolBarInfo>
{
......
}

When I use class ToolBarTable, the compiler report that it can't find the
method "count()" of the class ToolBarTable. But it works in VC++ 6.0.

[
In VC++ 6.0 , the code between
#if _MSC_VER > 1300 (it stands for VC.Net)
template <> class Array<ToolBarInfo> // Partial Implementation to makethe
compiler feel good
{
};
#endif

is not compiled, so when you declare public Array<ToolBarInfo>, it will
instantiate the first definition
template<class T>
class QMemArray<T> {
public :
......
int count();
}
which has the method count() defined.

While in VS.net , the code between #if _MSC_VER > 1300 .. #endif is
compiled, and when you declare
public Array<ToolBarInfo>, it will go to the closest match, which is the
version between #if _MSC_VER > 1300 .. #endif
and that one doesn't have count()" defined..

]
Another problem is that I have to use that "partial implementation"
otherwise the compiler will ask me to provider some operator (such as "==")
implementation of structure ToolBarInfo. Is there any method to avoid that?
[
I haven't tried that, if you post the whole declaration of the class,
people may give you a better answer..
]
 
J

Jianwei Sun

Hi,

Could you post your whole class declaration, and I am more happy to help you
take a look what is going on there, though I am not an expert either.

J.W.
Lei Jiang said:
If I removed that partial implementation, the error exists, plus more
errors: the VC7 compiler now ask me to provide the "==" operator of
ToolBarInfo.


Jianwei Sun said:
see inline..
Lei Jiang said:
I am upgrading our system from VC++ 6.0 to VC++7.0, and found some code
can't be compiled, for example :


template<class T>
class QMemArray<T>
{
public :
......
int count();
}

template<class T>
class Array : public QMemArray<T>
{
......
}

#if _MSC_VER > 1300
template <> class Array<ToolBarInfo> // Partial Implementation to make
the compiler feel good
{
};
#endif

class APPBASE_EXPORT ToolBarTable : public Array<ToolBarInfo>
{
......
}

When I use class ToolBarTable, the compiler report that it can't find the
method "count()" of the class ToolBarTable. But it works in VC++ 6.0.

[
In VC++ 6.0 , the code between
#if _MSC_VER > 1300 (it stands for VC.Net)
template <> class Array<ToolBarInfo> // Partial Implementation to makethe
compiler feel good
{
};
#endif

is not compiled, so when you declare public Array<ToolBarInfo>, it will
instantiate the first definition
template<class T>
class QMemArray<T> {
public :
......
int count();
}
which has the method count() defined.

While in VS.net , the code between #if _MSC_VER > 1300 .. #endif is
compiled, and when you declare
public Array<ToolBarInfo>, it will go to the closest match, which is the
version between #if _MSC_VER > 1300 .. #endif
and that one doesn't have count()" defined..

]
Another problem is that I have to use that "partial implementation"
otherwise the compiler will ask me to provider some operator (such as "==")
implementation of structure ToolBarInfo. Is there any method to avoid that?
[
I haven't tried that, if you post the whole declaration of the class,
people may give you a better answer..
]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top