To avoid this in TeXworks, there are several possibilities.
- Set the typesetting engine temporarily to "pdfLaTeX" by the pull down menu in the main window of TeXworks (see attachment).
- Add
% !TeX program = pdflatex
as very first line to the source code of your document and TeXworks will choose "pdfLaTeX" automatically every time.
- Set "pdfLateX" as default typesetting engine in the preferences of TeXworks (see attachment).
These settings apply to all possible typesetting tools available in TeXworks, not only PDFLaTeX.
Best regards and welcome to the board
Thorsten