Fontspec {cannot-use-pdftex} on overleaf

(Disclaimer: I'm a support personnel at Overleaf.)

This means your project uses the fontspec package, which can only be compiled with the XeLaTeX or LuaLaTeX engines, so you'll need to change your Overleaf project's compiler accordingly.


Switching compilers on Overleaf V2

Click on the Overleaf menu icon above the file list panel, and change the "Compiler" setting to "XeLaTeX" or "LuaLaTeX".


Switching compilers on Overleaf V1

Click on the Settings icon (i.e. the gear icon) above the preview panel of your Overleaf editor, and then select either "XeLaTeX" or "LuaLaTeX" from the "LaTeX engine" drop list.

Don't forget to click on "Save project settings" to apply the changes.