编译 c++ Visual C++ 7.1 没有 Visual C 的解决方案++

发布于 2024-11-24 17:52:18 字数 1147 浏览 0 评论 0原文

我需要构建一个 Visual C++ 解决方案(.dsp VC++ 7.1),该解决方案是由其他人在 2005 年编写的。我试图在 VS2010 试用版中编译该解决方案,但它给了我一些错误,如下所述

error C3867: 'CServerSocket::SelfDestruct': function call missing argument list; use '&CServerSocket::SelfDestruct' to create a pointer to member
error C2039: 'iterator_category' : is not a member of 'CommandDispatchInserter' c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C2146: syntax error : missing ';' before identifier 'iterator_category'   c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C2602: 'std::iterator_traits<_Iter>::iterator_category' is not a member of a base class of 'std::iterator_traits<_Iter>'  c:\program files\microsoft visual studio 10.0\vc\include\xutility

:调查显示,从 VS2005 开始,各种库的不同实现导致了错误,我认为代码相当不符合标准,这也是一个因素。我没有修改代码以适应 VS 的要求(我对此一无所知),而是想知道是否有一种方法可以编译这个 init 的当前状态,而不需要安装 VS2003 的实例。我尝试过在 Windows 上使用 minGW 但没有成功。它似乎不喜欢 MFC 库。有人对最有效的路线有什么建议吗?

提前致谢

I need to build a visual c++ solution (.dsp VC++ 7.1) which was written by someone else back in 2005. I'm attempting to compile the solution in VS2010 trial but it is giving me some errors as outlined below:

error C3867: 'CServerSocket::SelfDestruct': function call missing argument list; use '&CServerSocket::SelfDestruct' to create a pointer to member
error C2039: 'iterator_category' : is not a member of 'CommandDispatchInserter' c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C2146: syntax error : missing ';' before identifier 'iterator_category'   c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C2602: 'std::iterator_traits<_Iter>::iterator_category' is not a member of a base class of 'std::iterator_traits<_Iter>'  c:\program files\microsoft visual studio 10.0\vc\include\xutility

It seems from my investigations that from VS2005 onwards there are different implementations of various libraries which are causing the errors, I think the code is fairly non compliant with standards which is also a factor. Instead of amending the code to fit in with VS's requirement (which I'm fairly clueless about doing) I was wondering if there was a way of compiling this i nit's current state, short of installing an instance of VS2003. I have tried using minGW for windows but had no luck. It didn't seem to like the MFC libraries. Does anyone have any suggestions as to the most productive route to take?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

与他有关 2024-12-01 17:52:18

第一个错误(函数调用缺少参数列表;使用“&CServerSocket::SelfDestruct”)是 VS2003 和 VS2005 之间编译器的更改,以便更符合标准。据我所知,这里唯一的解决方案是按照消息建议修改代码。几年前我们升级VS的时候就遇到过好几个这样的情况;修复它们并不难。

我认为如果不以某种方式修改代码,你将无法在 VS2010 下编译它。我会开始一一修复它们;当然,其他四个错误似乎都是相互关联的,如果您找出其中的问题所在,则可能不需要进行太多更改即可修复。发布导致它的代码会对我们其他人有所帮助。

The first error (function call missing argument list; use '&CServerSocket::SelfDestruct') is a change in compiler between VS2003 and VS2005 to be more compliant with the standard. As far as I know, the only solution here is to amend the code as the message suggests. We had several cases of this when we upgraded VS some years ago; it's not that hard to fix them.

I don't think you are going to be able to compile this under VS2010 without amending the code somehow. I would start fixing them one by one; it certainly seems like the other four errors are all linked together and if you figure out what's wrong there it may not require much of a change to fix. Posting the code that causes it would help the rest of us.

静谧 2024-12-01 17:52:18

对于第一期,请使用 &显式获取指向成员的指针。没有其他方法可以让它用 VS9 或 10 进行编译。这是一个很容易添加的机械东西,只需要很少的 C++ 知识。

我认为第二个问题是您在某处缺少“typename”限定符。这更难,如果你不懂 C++,你能做的就很少。修复 &首先发布并发布编译器日志和代码以获得更好的答案。

至于你的实际问题,没有办法让它用新版本的 VS 进行编译;有一些“向后兼容性”编译器设置,但这些问题不包含在内。除了 Visual Studio 之外,您也无法使用任何编译器来编译 MFC 代码,因此花费更多时间在 MingW 路线上是没有用的。

因此,您的选择是:

  • 返回 Visual Studio 2003。很简单。
  • 修复代码。需要 C++ 知识和/或多次访问该网站。没那么容易。

顺便说一句,.dsp 不是 Visual Studio 7.1,它是 Visual Studio 6。如果是这样,您就更糟糕了,因为此后的变化比 7.1 (2003) 以来的变化要大得多

For the first issue, use the & to explicitly take a pointer to member. There is no other way to get this to compile with VS9 or 10. This is a mechanical thing that is easy to add, very little C++ knowledge needed.

The second issue is, I think, that you're missing a 'typename' qualifier somewhere. This is harder, if you don't know C++ there is only little you can do. Fix the & issue first and post compiler logs and code for better answers.

As to your actual question, no there is no way to get this to compile with newer versions of VS; there are some 'backwards compatibility' compiler settings but these issues aren't covered by it. Nor can you compile MFC code with any compiler other than the Visual Studio one, so the MingW route is useless to spend more time on.

So, your options are:

  • Go back to Visual Studio 2003. Easy.
  • Fix the code. C++ knowledge and/or many trips to this site required. Not so easy.

BTW, .dsp is not Visual Studio 7.1, it's Visual Studio 6. If so, you're screwed even more, because the changes since then are a lot bigger than since 7.1 (2003).

泪痕残 2024-12-01 17:52:18

您可以通过在 MSDN 中搜索错误代码来获取有关编译器错误的基本原理的详细信息,例如:当您声明的函数没有显式返回类型时,就会发生 C4430。 Visual C++ 6 此处假定为 int,后续版本将无法编译。

有关 MSDN 中的详细信息,请参阅此处 -其他错误代码搜索(在本例中是字符串 C4430)也将起作用。

此错误可能是由于编译器一致性工作而生成的
这是针对 Visual C++ 2005 所做的:所有声明都必须明确
指定类型;不再假定 int。

You can get detailed information on the rationale for a compiler error by searching on the error code in MSDN, eg. C4430 happens when you have a function declared without an explicit return type. Visual C++ 6 assumed int here, later versions will fail to compile.

See here for details in MSDN - other error code searches (in this case it was for string C4430) will also work.

This error can be generated as a result of compiler conformance work
that was done for Visual C++ 2005: all declarations must explicitly
specify the type; int is no longer assumed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文