Fatal error in latex

Hi there I am using texstudio version 2.12.6. I tried compiling a document (CV) but it keeps repeating the fatal error : "cannot-use-pdftex" The fontspec package requires either XeTeX or LuaTeX to function. You must change your typesetting engine to, e.g., "xelatex" or "lualatex" instead of plain "latex" or "pdflatex". For immediate help type H . I tried to configured the default compiler from pdflatex to xelatex but it will not just work. It keeps returning to pdflatex when I go back to check. Any help will be appreciated.

• your question is just about the editor you are using, but you have not said which editor that is. On the command line, calling latex directly switching from pdflatex to xelatex simply means typing xelatex file instead of pdflatex file. – David Carlisle Jan 25 '18 at 22:07

You can either go to the Tools -> Commands menu and choose xelatex, like this:
Or, change the default compiler, go to the Options -> Configure TeXstudio, choose the Build icon and change the default in the editing window: