Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:40:38+00:00 2026-06-16T07:40:38+00:00

This problem has been haunting me for weeks. I am using MS vs2010. #include

  • 0

This problem has been haunting me for weeks. I am using 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;
}

A simple program from C++ Primer. When I compile it, I get the following error information:

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

I was trying to find some solution, and I got this:

http://social.msdn.microsoft.com/Forums/nl-NL/Vsexpressvc/thread/31385f37-94b8-4297-b054-7fdbc5b1f51e

which says:

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.

Apparently some people fixed the problem with this solution. However, I could not even find _CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code); in my stdlib.h.

Anyone knows how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:40:40+00:00Added an answer on June 16, 2026 at 7:40 am

    I looked through the stdlib.h file, and found the the following line was commended out:

    It should NOT be commented out. That part of stdlib.h should look like this:

    #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
    

    It isn’t clear how it got to be commented in your version of the file. But it is clear that you don’t hesitate to edit compiler header files to get out of a problem. You may have done this before to bypass a problem and not remember it.

    In general, this is a Really Really Bad Idea. Microsoft releases service packs and security updates that will update compiler header files. But it will not do so if the file was altered. Which may leave you with a nasty mixed bag of files that are no longer compatible with each other.

    You will need to fix the damage done to these files. Pay attention to the modified timestamp of these files to find out which might have been changed. And copy those from a known-good machine of, say, a friend or colleague. Another possible approach (never tried it myself) is to move the altered files somewhere else and run setup again, asking for a repair. Not actually sure if that works, it should. Also re-apply service packs when you do it that way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem has been bugging me for a long time. For example, the code
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
Alright so this problem has been breaking my brain all day today. The Problem:
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
Edit : The bug that caused this problem has been fixed. The @version tag
This Jquery problem has been bugging me for a while now. I developed a
Apologize if this particular problem has been answered already (a search didn't turn anything
There was this problem that has been asked about implementing a load byte into
this has been an ongoing problem with me, ive been trying to make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.