Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


using the C++ Standard Library

Posted on 2005-04-12
Medium Priority
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

Axter earned 300 total points
ID: 13768280
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

r-k earned 200 total points
ID: 13769295
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

ID: 13770203
>causes compilation errors.

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

Expert Comment

ID: 13770333
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

ID: 13808516
thanks for all the answers.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

578 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