Language: C++

#include<iostream>
using namespace std;

class Node{
	public:
		Node* prev;
		Node* next;
		int data;
		Node(){
			prev=0;
			next=0;
			data=0;
		}
};

class LinkedList{
	private:
		Node head;
	public:
		LinkedList(){
			head.prev=&head;
			head.next=&head;
		}
		int inseart(int x);
		int del(int x);
		int deleteFirst();
		int deleteLast();
		void print();
};

int List::insert(int x){
	Node* p=new Node();
	if(p==0){
		return -1;
	}
	Node* q=&head;
	Node* r=&head.next;
	p->prev=q;
	p->next=r;
	p->data=x;
	q->next=p;
	r->prev=p;
	return 0;
}

int List::del(int x){
	Node* p;
	for(p=head.next;p!=&head;p=p->next){
		if(p->data==x){
			break;
		}
	}
	if(p==&head){
		return -2;
	}
	Node* q=p->prev;
	Node* r=p->next;
	q->next=r;
	r->prev=q;
	delete p;
	return 0;
}

int List::deleteFirst(){
	Node* p=head.next;
	if(p==&head){
		return -2;
	}
	Node* q=p->prev;
	Node* r=p->next;
	q->next=r;
	r->prev=q;
	delete p;
	return 0;
}
	
int List::deleteLast(){
	Node* p=head.prev;
	if(p==&head){
		return -2;
	}
	Node* q=p->prev;
	Node* r=p->next;
	q->next=r;
	r->prev=q;
	delete p;
	return 0;
}

void List::print(){
	for(Node* p=head.next;p!=head;p=p->next){
		cout<<p->data;
		if(p->next!=&head){
			cout<<' ';
		}else{
			cout<<endl;
		}
	}
}

int main(){
	List L;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		char com[20];
		cin>>com;
		if(com[0]=='i'){
			int x;
			cin>>x;
			L.insert(x);
		}else if(com[6]=='F'){
			L.deleteFirst();
		}else if(com[6]=='L'){
			L.deleteLast();
		}else{
			int x;
			cin>>x;
			L.del(x);
		}
	}
	L.print();

	return 0;
}

Compiler output:
a.cc:31:5: error: 'List' has not been declared
   31 | int List::insert(int x){
      |     ^~~~
a.cc: In function 'int insert(int)':
a.cc:36:18: error: 'head' was not declared in this scope
   36 |         Node* q=&head;
      |                  ^~~~
a.cc: At global scope:
a.cc:46:5: error: 'List' has not been declared
   46 | int List::del(int x){
      |     ^~~~
a.cc: In function 'int del(int)':
a.cc:48:15: error: 'head' was not declared in this scope
   48 |         for(p=head.next;p!=&head;p=p->next){
      |               ^~~~
a.cc:53:16: error: 'head' was not declared in this scope
   53 |         if(p==&head){
      |                ^~~~
a.cc: At global scope:
a.cc:64:5: error: 'List' has not been declared
   64 | int List::deleteFirst(){
      |     ^~~~
a.cc: In function 'int deleteFirst()':
a.cc:65:17: error: 'head' was not declared in this scope
   65 |         Node* p=head.next;
      |                 ^~~~
a.cc: At global scope:
a.cc:77:5: error: 'List' has not been declared
   77 | int List::deleteLast(){
      |     ^~~~
a.cc: In function 'int deleteLast()':
a.cc:78:17: error: 'head' was not declared in this scope
   78 |         Node* p=head.prev;
      |                 ^~~~
a.cc: At global scope:
a.cc:90:6: error: 'List' has not been declared
   90 | void List::print(){
      |      ^~~~
a.cc: In function 'void print()':
a.cc:91:21: error: 'head' was not declared in this scope
   91 |         for(Node* p=head.next;p!=head;p=p->next){
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:102:9: error: 'List' was not declared in this scope
  102 |         List L;
      |         ^~~~
a.cc:111:25: error: 'L' was not declared in this scope
  111 |                         L.insert(x);
      |                         ^
a.cc:113:25: error: 'L' was not declared in this scope
  113 |                         L.deleteFirst();
      |                         ^
a.cc:115:25: error: 'L' was not declared in this scope
  115 |                         L.deleteLast();
      |                         ^
a.cc:119:25: error: 'L' was not declared in this scope
  119 |                         L.del(x);
      |                         ^
a.cc:122:9: error: 'L' was not declared in this scope
  122 |         L.print();
      |         ^