• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Using STL in Visual C++

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
Diceman_01
Asked:
Diceman_01
  • 2
1 Solution
 
mrwad99Commented:
Add "using namespace std"...

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

using namespace std;

HTH
0
 
mrwad99Commented:
Alternatively, to prevent importing the whole of the standard namespace, you could just add

using std::list;
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now