- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
这个问题困扰了我几个星期。我正在使用 MS vs2010。
#include <iostream>
int main()
{
std::cout << "Enter two numbers:" << std::endl;
int v1 = 0, v2 = 0;
std::cin >> v1 >> v2;
std::cout << "The sum of " << v1 << " and " << v2
<< " is " << v1 + v2 << std::endl;
return 0;
}
C++ Primer 中的一个简单程序。当我编译它时,我得到以下错误信息:
1>e:\program files\microsoft visual studio 10.0\vc\include\cstdlib(24): error C2039: 'exit' : is not a member of '`global namespace''
1>e:\program files\microsoft visual studio 10.0\vc\include\cstdlib(24): error C2873: 'exit' : symbol cannot be used in a using-declaration
我试图找到一些解决方案,我得到了这个:
上面写着:
SOLUTION FOUND:
I have researched this issue on the web and it seems like it is something that has been an issue for a lot of people. The solution to this is as simple as removing a comment.
I looked through the stdlib.h file, and found the the following line was commended out:
_CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code);
I took out the comment and recompiled it, and now it works.
I believe in some builds the stdlib.h file will automatically be compiled with that portion of the code commented out. simple uncomment and your code will work.
显然有人用这个解决方案解决了这个问题。但是,我什至在我的 stdlib.h 中找不到 _CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code);
。
有人知道如何解决这个问题吗?
最佳答案
I looked through the stdlib.h file, and found the the following line was commended out:
它应该不被注释掉。 stdlib.h 的那部分应该是这样的:
#ifndef _CRT_TERMINATE_DEFINED
#define _CRT_TERMINATE_DEFINED
_CRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
_CRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
_CRTIMP __declspec(noreturn) void __cdecl abort(void);
#endif
不清楚它是如何在您的文件版本中被注释的。但很明显,您会毫不犹豫地编辑编译器头文件以摆脱问题。您之前可能已经这样做过以绕过问题并且忘记了它。
总的来说,这是一个非常非常糟糕的主意。 Microsoft 发布了将更新编译器头文件的服务包和安全更新。但如果文件被更改,它不会这样做。这可能会给您带来一大堆彼此不再兼容的文件。
您需要修复对这些文件造成的损坏。注意这些文件的修改时间戳,找出哪些可能已被更改。并从 friend 或同事的一台已知良好的机器上复制那些。另一种可能的方法(我自己从未尝试过)是将更改的文件移到其他地方并再次运行安装程序,要求修复。实际上不确定这是否有效,它应该。当您这样做时,还要重新应用服务包。
关于c++ - 在 vs2010 中使用 iostream 时,出现错误 C2039 : 'exit' : is not a member of '` global namespace'',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14014348/
我们有一个包含重复用户记录的数据库,我需要根据几个因素选择“最佳”用户: 应先选择具有成员(member)资格的用户,然后再选择没有成员(member)资格的用户 成员(member)有级别,在所有条
不知道为什么 Visual Studio 发出此警告: Access of shared member, constant member, enum member or nested type thr
我有一个数据库设置来注册网站的成员(member)专用区域的成员(member)。我可以使用复选框回显所有注册成员,以便我可以选择从管理页面删除单个成员,但我似乎无法弄清楚如何在单击提交按钮时选择删除
假定前缀一元运算符可以“由不带参数的非静态成员函数或带一个参数的非成员函数实现”(§13.5.1[over.unary]/1),除了适用于任何成员/非成员函数选择的通常封装/代码重用设计原理之外,还有
拥有 struct Person { string name; }; Person* p = ... 假设没有运算符被重载。 哪个更有效(如果有的话)? (*p).name 对比 p->name
进程文件: members-area or members-area.exe 进程名称: 5-1-61-96 进程类别:存在安全风险的进程 英文描述: 
引用资料 http://msdn.microsoft.com/en-us/library/6tc47t75%28v=VS.80%29.aspx http://msdn.microsoft.com/en
这个问题在这里已经有了答案: Is there any reason to use this-> (16 个答案) 关闭 7 年前。 这有什么区别: int MyClass::getId() {
我正在制作一个网站,您需要在其中注册,然后创建一个角色来玩。我如何将注册页面中使用的表格与玩家的表格结合起来,以便玩家始终获得他创建的角色。 我有一个表members,用于存储注册用户以及角色的 ta
我处于困境中,我被委托(delegate)创建一个 PHP Web 应用程序,该应用程序允许一个人注册,然后该用户可以再注册 5 个其他用户,他注册的其他用户也可以每个注册 5 个成员。 我希望创建数
我试图在成员(member)页面上显示一个非常简单的用户名。我已经在 stackoverflow 上搜索过,但使用我发现的内容不起作用。 我使用 HTML 表单指南中非常常见的注册/登录脚本,该脚本使
我正在使用CodeIgniter,我的问题是关于MySQL查询。我有两个表,分别是成员和关系。 成员表 我正在做的是,根据member_type将所有用户添加到成员表中。如果 member_type
我有一个表,用于存储 2 个成员(成员 A 和成员 B)之间的聊天信息。现在,当成员 A 删除他的消息时,我会抛出这样的 sql 请求 $deleting = mysqli_query($connec
from bs4 import BeautifulSoup import requests r = requests.get('http://medicalassociation.in/doctor-
我有两个我无法修改的类,它们都具有完全相同的成员: class Pose1 { public: double x,y; }; class Pose2 { public: d
我正在测试服务器上运行机器人。当前 channel 中有 3 个成员(member_count of 3),但它只返回一个成员。该成员是机器人。 代码: import discord from dis
我有一个对象,我们称之为 o,以及对 o 的引用。 在o范围内,我设置了一个成员,我们称之为m。 所以在 o 中,我调用: o.m = "blah" 在 o 之外,我访问 m: console.log
我正在尝试实现自定义成员(member)资格提供程序并希望更改 GetUser 方法。问题是 GetUser 返回 MembershipUser,而我想返回 MyMembershipUser,它有两个
我的网站有一个推荐给 friend 的按钮。为了鼓励人们使用此功能,我想用积分奖励那些使用它的人(积分将兑换奖品......还不知道)。 好的,所以我有这样的结构: 表单.php 您可以在此处输入 f
我在 MySQL 中有三个表, 组(键:group_id) 成员(键:member_id) group_member_relations 键:group_id, member_id 最后一个表包含 m
我是一名优秀的程序员,十分优秀!