masuberu
masuberu

Reputation: 117

error: identifier "list" is undefined (new to Visual C++)

I just want to initialize a List on Visual C++ but I am getting following errors:

why is this happening?

my includes:

#include "stdlib.h"
#include "malloc.h"
#include "stdio.h"
#include <set>
#include <vector>
#include <string>
#include <list>
#include "stdafx.h"
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <fstream>
#include <WebServices.h>
#include "./WCF_managed_app.xsd.h"
#include "./WCF_managed_app_Client.wsdl.h"
#include "./WCF_managed_app_Client.xsd.h"
#include "./schemas.microsoft.com.2003.10.Serialization.xsd.h"

Upvotes: 1

Views: 6687

Answers (1)

Stephane Rolland
Stephane Rolland

Reputation: 39896

you probably have forgotten the using namespace std; in your cpp file so as to have access to the definition of list that resides into the std namespace.

personnaly I prefer not to use using namespace std;

and I use std::list rather of list in my cpp files

std::list<Element> myList;
myList.push_back(anElement);

Upvotes: 6

Related Questions