using the C++ Standard Library

Posted on 2005-04-12
Last Modified: 2013-11-20

I am trying to use the Standard Library in an MFC or Win32 app

#include <iostream>

causes compilation errors. Can I use Standard Library in MFC,
it works in WIN32 but how can I get the cout, output window

Do I have to create a different type of project?

just want to play about with the standard library as its been a while
and I have no other C++ compiler.

Question by:antinutrino
    LVL 30

    Accepted Solution

    Hi antinutrino,
    >> Do I have to create a different type of project?
    If you want to play around with cout, you should create a console application.

    David Maisonave :-)
    LVL 32

    Assisted Solution

    Yes, the std library works well with MFC, but you have to use a console application as Axter suggested if you want to use iostream.
    LVL 16

    Expert Comment

    >causes compilation errors.

    Try to add after the #include :
    using namespace std;

    Expert Comment

    If you include #include <iostream> at the top of the main project include file i.e. stdafx.h, you will not get compilation error, though there will be heaps of warnings issued.

    Author Comment

    thanks for all the answers.


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now