TFS 构建上出现 C2360 编译器错误,但桌面上没有
类似于下面代码的 c++/cli 代码片段导致我们的 TFS 构建失败并出现 C2360 编译器错误。
switch (i)
{
case 0 :
for each (int n in a)
System::Console::WriteLine(n.ToString());
break;
case 1 :
System::Console::WriteLine("n is not in scope here");
break;
}
通过在案例 0 的主体中使用 {} 括号可以解决此问题,如下所示:
switch (i)
{
case 0 :
{
for each (int n in a)
System::Console::WriteLine(n.ToString());
}
break;
case 1 :
System::Console::WriteLine("n is not in scope here");
break;
}
开发人员在提交更改之前已在其桌面上成功编译了代码。
粗略地看一下服务器和桌面上的编译器、Visual Studio 等版本,表明它们是相同的。
显然,源代码是相同的。
桌面构建和 TFS 构建之间有什么区别,会消除这样的编译器错误?
A c++/cli code snippet similar to the code below caused our TFS build to fail with a C2360 compiler error.
switch (i)
{
case 0 :
for each (int n in a)
System::Console::WriteLine(n.ToString());
break;
case 1 :
System::Console::WriteLine("n is not in scope here");
break;
}
This is fixed by using {} brackets within the body of case 0, as below:
switch (i)
{
case 0 :
{
for each (int n in a)
System::Console::WriteLine(n.ToString());
}
break;
case 1 :
System::Console::WriteLine("n is not in scope here");
break;
}
The developer had successfully compiled the code on their desktop before committing the changes.
A cursory look at versions of things like compilers, Visual Studio etc on the server and desktop suggest they are the same.
The source code is the same, obviously.
What is the difference between a desktop build and TFS build that would smother a compiler error like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论