-Steve 我还没有看到任何东西进入这个低级细节的东西。在 一般情况下,VC7中的变化(甚至更多,VC7.1)使编译器更接近C ++标准一致性,因此VC6接受的代码不是'$ 相当标准的符合性将经常被VC7 {.1}踢出。 -cd I am having a very hard time getting my 6.0 C++ template code tocompile on C++ .NET.The following is one example of code that compiles in 6.0 but not in..NET. Any ideas why?-----------------------------------------#include<list>template <class A> class Cursor : public std::list<A>::iterator{voidPosAfterActual( std::list<A>::iterator it ) ;} ;------------------------------------------------Error message is:c:\SrcomNet\TestTclass2.h(8) : warning C4346:''std::list<_Ty>::iterator'' : dependent name is not a typeprefix with ''typename'' to indicate a typec:\SrcomNet\TestTclass2.h(9) : see reference to class templateinstantiation ''Cursor<A>'' being compiledc:\SrcomNet\TestTclass2.h(8) : error C2061: syntax error : identifier''iterator''Any help is very appreciated.-Steve Richter 解决方案-cd Because your code is not legal according to the C++ standard: a dependent name is not a type unless prefixed with the typename keyword. void PosAfterActual( typename std::list<A>::iterator it );What a language! Using it for 5 years and I still dont know what I amdoing.This code, ok in 6.0, also did not compile in .NET:HANDLE* pFile ;vector<HANDLE> vec ;vector<HANDLE>::iterator it ;it = vec.begin( ) ;pFile = it ;it had to be changed to:pFile = &(*it) ;I dont like these changes. My code is windows specific, so portabilityis a low priority. And the mods I have to make to my code appear tomake it less readable.Does MS have a document that gets into the details of what was allowedin VC++ 6.0 and is not in C++ .NET? I saw a migration guide on theMSDN site, but it did not detail what I am running into.thanks,-SteveI haven''t seen anything that gets into this low level detail stuff. Ingeneral, the changes in VC7 (and even more so, VC7.1) make the compiler muchcloser to C++ standards conformance, so code that VC6 accepted that wasn''tquite standard conforming will frequently be kicked out by VC7{.1}.-cd 这篇关于代码编译c ++ 6.0,而不是c ++ .NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 09:58