In this paper, we first generalize the complementary pair of codes over finite fields to an l-linear complementary pair (l-LCP) of codes. Then two criteria of l-LCP of codes over finite fields are obtained. We especially investigate l-LCP of constacyclic codes. When C and D are all λ\documentclass[12pt]{minimal}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{mathrsfs}
\usepackage{upgreek}
\setlength{\oddsidemargin}{-69pt}
\begin{document}$$\lambda $$\end{document}-constacyclic codes, we obtain a characterization of (C, D) to be l-LCP of codes. When C and D are cyclic and negacyclic codes, we give a sufficient condition of (C, D) to be l-LCP of codes. As an application, by means of the l-LCP of codes over finite fields, we exhibit two methods of constructing entanglement-assisted quantum error correcting (EAQEC) codes. Notably, the parameters of our EAQEC codes are new and flexible.