I have the ambition to make a List, Global so it can be reached within other Threads.

When compiling the code with the declared list like this the compiler says:
syntax error : missing ';' before '<'

Should I declare the List in any other way than this ?
(The code compiles success if I take the declared List away so the problem is the declaration of the List.

Also if I try to declare the List within an eventhandler of ex: a button like this.
List<String^>^ All;
The compiler says:
'List' : undeclared identifier
'System:: String' : illegal use of this type as an expression
syntax error : '>'

#pragma once

#include "stdafx.h"
#include <ctime>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream> 
#include <string>  
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <ios>
#include <cstdio>
#include <numeric>
#include <cstdlib>
#include <ctype.h> 
#include <stdio.h>


namespace Form1 {

using namespace System;
using namespace System::IO;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;
using namespace System::Runtime::InteropServices;
using namespace System::Threading;

	public ref class Form2 : public System::Windows::Forms::Form
	{


		List<String^>^ All;

		//Rest of code


}
}

I founded out that this namespace was needed for this.

using namespace System::Collections::Generic;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.