反馈:C++已经转向 VS2010 的开发人员?
我正在考虑将我们的商店从 VS2008sp1 迁移到 VS2010。我对 2008 年非常满意,但想在我们的代码中使用 TR1。
我真的对 2010 年与 2008 年的程序员伙伴的完形感兴趣,而不是对以下任何一个元素的解决方案感兴趣!
但是,我正在转换我们的项目和项目。我发现“噪声与信号”的比率相当蹩脚,IMO。到目前为止,我正在考虑重新连接每个项目,我们必须摆脱各种明显虚假的 Microsoft Build 警告,例如 $(TargetExt) ...与链接器的 OutputFile 属性值不匹配...
有几种变体关于此消息,每个项目有几个,我们大约有 75 个项目。我很少或根本不想浪费时间重做所有这些项目的输出目标(显然 MSBuild 坚持认为链接器的目标和编译器的目标相同,这对我们来说既没有必要也不可取)。
另外,[尴尬],我们还是用VSS。就在我最初尝试调整项目以使其符合 MSBuild 的过程中,我发现 VS2010 中的 VSS 界面速度大约是 2008 年的 1/4。这太糟糕了(而且我已经习惯了相对蹩脚的界面)。 VSS 的总体性能)。
叹息...我知道大约 1/2 或更多的“答案”将是“停止使用 VSS”。是的,这是一个好主意,我们可能会在不久的将来转向颠覆。但一次只做一件事。这只能解决 VSS 速度问题,不能解决 MSBuild 问题,也不能解决新的 C++ 问题。
看来新的标准库和 TR1 的东西已经破坏了我们的一些代码。这本身并不算太令人震惊——如果情况并非如此,我会感到惊讶。但就目前情况而言,错误消息是 LOOOONNNNNGGGG - 它让我想起了我早期尝试使用 STL 的日子,并且必须加载一个错误字符串解析器帮助程序,该帮助程序为我推导出更高级别的名称,以便错误消息可能变得有点有用。现在,十年后,我再次看到诊断如此深入和复杂,以至于毫无意义,我不知道真正的问题是什么。在一种情况下,我试图在多重映射中插入一个新元素:
typedef CCimexDataSource::CategoryID CategoryID;
typedef std::multimap<CString, CCimexDataSource *> description_sources_multimap;
typedef std::map<CategoryID, description_sources_multimap> category_sources_map;
// attempt to insert a new description->CCimexDataSource* keyed by CategoryID (an unsigned)
m_category_sources_map[it->GetCategory()].insert(std::make_pair(it->GetDescription(), &(*it)));
我得到:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2440: 'initializing' : cannot convert from 'const CCimexDataSource *' to 'CCimexDataSource *'
1> Conversion loses qualifiers
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(255) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,const CCimexDataSource>(_Other1 &&,_Other2 &&)' being compiled
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *,
1> _Ty=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Other1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Other2=const CCimexDataSource *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(208) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<ATL::CStringT<BaseType,StringTraits>,const CCimexDataSource*>(std::pair<ATL::CStringT<BaseType,StringTraits>,const CCimexDataSource *> &&)' being compiled
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *,
1> BaseType=char,
1> StringTraits=StrTraitMFC<char>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(280) : see reference to function template instantiation 'void std::allocator<_Ty>::construct<std::pair<_Ty1,_Ty2>>(std::pair<const _Kty,CCimexDataSource> *,_Other &&)' being compiled
1> with
1> [
1> _Ty=std::pair<const CString,CCimexDataSource *>,
1> _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Ty2=const CCimexDataSource *,
1> _Kty=CString,
1> _Other=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(592) : see reference to function template instantiation 'void std::_Cons_val<std::allocator<_Ty>,_Ty,std::pair<_Ty1,_Ty2>>(_Alloc &,std::pair<const _Kty,CCimexDataSource> *,std::pair<_Ty1,_Ty2> &&)' being compiled
1> with
1> [
1> _Ty=std::pair<const CString,CCimexDataSource *>,
1> _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Ty2=const CCimexDataSource *,
1> _Alloc=std::allocator<std::pair<const CString,CCimexDataSource *>>,
1> _Kty=CString
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(755) : see reference to function template instantiation 'std::_Tree_nod<_Traits>::_Node *std::_Tree_val<_Traits>::_Buynode<_Ty>(_Valty &&)' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>,
1> _Ty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>,
1> _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(364) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::insert<_Ty>(_Valty &&)' being compiled
1> with
1> [
1> _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>>>,
1> _Ty2=bool,
1> _Traits=std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>,
1> _Ty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>,
1> _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1> c:\users\steve\projects\cimex cad-cam\14.0\cimex application\cimcad\formaddautomaticpage.h(17) : see reference to function template instantiation 'std::_Tree_iterator<_Mytree> std::multimap<_Kty,_Ty>::insert<std::pair<_Ty1,_Ty2>>(_Valty &&)' being compiled
1> with
1> [
1> _Mytree=std::_Tree_val<std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>>,
1> _Kty=CString,
1> _Ty=CCimexDataSource *,
1> _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Ty2=const CCimexDataSource *,
1> _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be initialized
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(167) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::second'
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *
1> ]
注意:上面的内容似乎是 std::set<> 的改变方式。有效,这样它们总是返回 const_iterators 而不是 iterators(1)。但重点只是举一个例子来说明与 2008 年相比,编译器诊断要复杂得多。
所以,我的问题是:对于最近进行了转换的任何 C++ 商店:您对转换感到遗憾还是欣赏它?怎么会这样?
(1) Scott Meyer 的“Effective STL”,(c) 2001,p95,第 22 项。
我刚刚遇到了这个:它涵盖了我遇到的许多代码破坏性更改: http://blogs.msdn.com/b/vcblog/archive/2009/05/25/stl-writing-changes-in-visual-studio-2010-beta-1.aspx ?wa=wsignin1.0
I'm considering moving our shop over to VS2010 from VS2008sp1. I've been very happy with 2008, but would like to make use of TR1 in our code.
I'm really interested in fellow programmers gestalt of 2010 v. 2008, rather than the solution to any one element of the following!
However, I'm in the process of converting our projects & solutions, and I'm finding that the "noise to signal" ratio is rather lame, IMO. So far, I'm looking at rewiring every single project we have to get rid of the various apparently spurious Microsoft Build warnings, such as $(TargetExt) ... does not match the Linker's OutputFile property value ...
There are several variations on this message, several per project, and we have around 75 projects. I have little or no desire to waste my time redoing all of these projects output targets (Apparently MSBuild insists that the linker's target and the compiler's target be identical, which is neither necessary nor desirable for us).
Additionally, [embarrassment], we still use VSS. And just in my initial dealings with trying to massage the projects to compliance with MSBuild, I'm finding that the VSS interface in VS2010 is about 1/4 as fast as in 2008. It's atrocious (and I'm used to the relatively lame performance of VSS in general).
Sigh... I know about 1/2 or more of the "answers" are going to be "Stop using VSS." Yeah, that's a great idea, and we may migrate to subversion in the not too distant future. But one thing at a time. That only solves the VSS speed issue, not the MSBuild problems, nor the new C++ problems.
It seems that the new standard libraries and TR1 stuff has broken some of our code. That's not in itself too shocking - I'd have been surprised if that weren't the case. But as it stands, the error messages are LOOOONNNNNGGGG - it reminds me of my early days of trying to use the STL and having to load an error string parser helper that deduced the higher-level names for me so that the error messages could become somewhat useful. Now, 10 years later, I'm back to seeing diagnostics so deep and convoluted that they make no sense, and I have no idea what the real issue is. In one case I'm attempting to insert a new element in a multimap:
typedef CCimexDataSource::CategoryID CategoryID;
typedef std::multimap<CString, CCimexDataSource *> description_sources_multimap;
typedef std::map<CategoryID, description_sources_multimap> category_sources_map;
// attempt to insert a new description->CCimexDataSource* keyed by CategoryID (an unsigned)
m_category_sources_map[it->GetCategory()].insert(std::make_pair(it->GetDescription(), &(*it)));
And I get:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2440: 'initializing' : cannot convert from 'const CCimexDataSource *' to 'CCimexDataSource *'
1> Conversion loses qualifiers
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(255) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,const CCimexDataSource>(_Other1 &&,_Other2 &&)' being compiled
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *,
1> _Ty=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Other1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Other2=const CCimexDataSource *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(208) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<ATL::CStringT<BaseType,StringTraits>,const CCimexDataSource*>(std::pair<ATL::CStringT<BaseType,StringTraits>,const CCimexDataSource *> &&)' being compiled
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *,
1> BaseType=char,
1> StringTraits=StrTraitMFC<char>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(280) : see reference to function template instantiation 'void std::allocator<_Ty>::construct<std::pair<_Ty1,_Ty2>>(std::pair<const _Kty,CCimexDataSource> *,_Other &&)' being compiled
1> with
1> [
1> _Ty=std::pair<const CString,CCimexDataSource *>,
1> _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Ty2=const CCimexDataSource *,
1> _Kty=CString,
1> _Other=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(592) : see reference to function template instantiation 'void std::_Cons_val<std::allocator<_Ty>,_Ty,std::pair<_Ty1,_Ty2>>(_Alloc &,std::pair<const _Kty,CCimexDataSource> *,std::pair<_Ty1,_Ty2> &&)' being compiled
1> with
1> [
1> _Ty=std::pair<const CString,CCimexDataSource *>,
1> _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Ty2=const CCimexDataSource *,
1> _Alloc=std::allocator<std::pair<const CString,CCimexDataSource *>>,
1> _Kty=CString
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(755) : see reference to function template instantiation 'std::_Tree_nod<_Traits>::_Node *std::_Tree_val<_Traits>::_Buynode<_Ty>(_Valty &&)' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>,
1> _Ty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>,
1> _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(364) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::insert<_Ty>(_Valty &&)' being compiled
1> with
1> [
1> _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>>>,
1> _Ty2=bool,
1> _Traits=std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>,
1> _Ty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>,
1> _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1> c:\users\steve\projects\cimex cad-cam\14.0\cimex application\cimcad\formaddautomaticpage.h(17) : see reference to function template instantiation 'std::_Tree_iterator<_Mytree> std::multimap<_Kty,_Ty>::insert<std::pair<_Ty1,_Ty2>>(_Valty &&)' being compiled
1> with
1> [
1> _Mytree=std::_Tree_val<std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>>,
1> _Kty=CString,
1> _Ty=CCimexDataSource *,
1> _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1> _Ty2=const CCimexDataSource *,
1> _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be initialized
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(167) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::second'
1> with
1> [
1> _Ty1=const CString,
1> _Ty2=CCimexDataSource *
1> ]
Note: the above appears to be a change in how std::set<> works, such that they always give back const_iterators instead of iterators(1). But the point is just to have an example of how much more convoluted the compiler diagnostics are compared to 2008.
So, my question: for any c++ shops out there that have converted recently: do you regret the conversion, or appreciate it? How so?
(1) Scott Meyer's "Effective STL", (c) 2001, p95, item 22.
I just ran into this: it covers many of the code-breaking changes I've been running into:
http://blogs.msdn.com/b/vcblog/archive/2009/05/25/stl-breaking-changes-in-visual-studio-2010-beta-1.aspx?wa=wsignin1.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
回答你的第一个问题:
&(*it)
的类型可能是const CCimexDataSource *
,而不是CCimexDataSource *
。就第二个讨论问题提供意见:
我们已经从 VS2008 转换到 VS2010,效果很好,虽然 VS2010 速度较慢,但它有更好的智能感知。转换不是全自动的,之后我们必须手动更新 vcxproj 文件。
To answer your first question: Type of
&(*it)
is probablyconst CCimexDataSource *
, and notCCimexDataSource *
.To give input on your second discussion-question:
We have converted from VS2008 to VS2010, and it has worked out fine, although VS2010 is slower, it has a bit better intellisense. The conversion wasn't fully automatic, and we had to manually update the vcxproj files afterward.
在工作中,我们从VS2005迁移到VS2010没有任何问题。然而,我发现在我的家用计算机上,我必须关闭 VS2010 中的许多 Intellisense 功能,因为它消耗了我笔记本电脑上太多的处理能力,以至于我一次只能输入几个字符,然后不得不等待更新数据库需要 3 分钟。如果您在 Windows 7 上运行相当新的计算机(四核 ~3 GHz,至少 6 GB RAM),则应该不会出现性能问题。如果您(就像我在家一样)在 XP 上使用具有 2 GB RAM 的 Core2 Duo,您会发现必须关闭许多功能才能使 IDE 发挥作用。
注意:VS2008 在我的笔记本电脑上运行得非常好;当我“升级”时,我感到相当失望。
At work, we moved from VS2005 to VS2010 with no problems. However, I found that on my home computer, I had to turn off many of the Intellisense features in VS2010 as it was eating up so much processing power on my laptop that I could only type out a few characters at a time before having to wait 3 minutes for it to update its database. If you are running on a fairly new machine (Quad-core ~3 GHz with at least 6 GB RAM) on Windows 7, you should have few performance problems. If you (like I am at home), use a Core2 Duo with 2 GB RAM on XP, you'll find that you have to turn off many features for the IDE to be useful.
NOTE: VS2008 ran wonderfully on my laptop; I was rather disappointed when I "upgraded".
我的家用电脑(Core2Duo E6600,2 GB RAM)上的智能感知没有任何问题。我唯一不喜欢的是用户界面的响应能力。它非常迟缓。
我相信 TR1 和 C++0x 的改进超过了 UI 缓慢的缺点。
I have no problem on my home PC (Core2Duo E6600, 2 GB RAM) with intellisense. The only thing i don't like is the responsiveness of the UI. It's very sluggish.
I believe the improvements in TR1 and C++0x outweight the drawbacks of the slow UI.
我尝试用 100 个项目转换我们的解决方案(VS2005),在更新项目文件失败后,我决定暂时放弃,因为我什至无法让它开始编译。
使用 VS2010 进行新的 .net 项目时,我发现 IDE 试图变得更像 Eclipse,但它不断执行一些愚蠢的操作,例如在我上次单击的视图部分中打开代码文件 - 比如说输出或监视变量窗口。
我经常在使用 MS 符号服务器时遇到麻烦,专门转到 MS 符号服务器的调试/模块功能似乎可以以某种方式解决这个问题,并节省弄乱符号服务器列表的时间。
I tried converting our solution (VS2005) with 100 projects and after all the failures to update the project files I decided to give up for the time being as I couldn't even get it to start compiling.
Using VS2010 for new .net projects I find the IDE tries to be a bit more like Eclipse, but it keeps doing dopey things like opening code files in the view portion I last clicked on - say the output or watch variables windows.
Every so often I have trouble with the MS symbol servers, the debug/module feature to specifically go to the MS symbol server seems to get around this somehow and saves time messing with the symbol server list.