Solved

Using STL in Visual C++

Posted on 2004-10-17
2
244 Views
Last Modified: 2013-12-14
Here is my code:
=========BEGIN CODE=========
#include "stdafx.h"
#include <list>

int main(int argc, char* argv[])
{
      list<int> coordList;

      return 0;
}
=========END CODE=========

Here are my compile errors:
=========BEGIN ERRORS=========
--------------------Configuration: Life - Win32 Debug--------------------
Compiling...
Life.cpp
D:\Source Code\Life\Life.cpp(39) : error C2065: 'list' : undeclared identifier
D:\Source Code\Life\Life.cpp(39) : error C2062: type 'int' unexpected
Error executing cl.exe.

Life.exe - 2 error(s), 0 warning(s)
=========END ERRORS=========

I'm convinced it's something simple to fix, but I haven't the foggiest what it could be.   Any help is, as always, appreciated.
0
Comment
Question by:Diceman_01
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
mrwad99 earned 100 total points
ID: 12333362
Add "using namespace std"...

#include "stdafx.h"
#include <list>

using namespace std;

HTH
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12333365
Alternatively, to prevent importing the whole of the standard namespace, you could just add

using std::list;
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Find Visual Studio Tools 2 103
How to convert MFC::CString to UTF8 wchar_t* 10 209
Add values of each row in an array 3 57
DCT of  2D array using fftw in c++ 9 41
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

773 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