[Tex/LaTex] pdflatex error when rendering TeX as PDF in TeXstudio on Windows 7

miktexpdftextexstudio

I installed TeX using MiKTeX and installed TeXstudio using the basic installer, but whenever I compile a TeX file (.tex) using pdflatex in TeXstudio I receive this error:
enter image description here

TeXworks (which came bundled with MiKTeX) is able to compile using pdflatex without a problem.

I tried the command line to see what was going on and this is what I got:

C:\Users\Brenton\Documents\LaTeX>pdflatex -synctex=1 -interaction=nonstopmode "Amide condensation reaction".tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9 64-bit)
(Fatal format file error; I'm stymied)

I have also tried to configure the program, changing pdflatex.exe in the command for pdftex to the full location of pdflatex on my system. These are my settings.

enter image description here

but still I receive this message:

Process started: "C:/Program Files/MiKTeX/miktex/bin/x64/pdflatex.exe" -synctex=1 -interaction=nonstopmode "Amide condensation reaction".tex

Process exited with error(s)

Best Answer

The error message "Fatal format file error; I'm stymied" means that TeX binary is trying to load latex.fmt (or pdflatex.fmt) but the version of this TeX binary differs from another TeX binary which created such latex.fmt. There could be two reasons: you have installed two TeX binaries (in different versions) or you have somewhere in your computer the old latex.fmt from previous TeX installation.

The pdflatex.exe must be implemented as one what runs TeX binary (most probably pdftex.exe) and sets the message to this binary: "hey, load pdflatex.fmt". And this loading is broken as described above. I don't know how exactly it is implemented in MikTeX, sorry. I never used MS Windows.

New TeX distributions has more TeX binaries: "tex", "pdftex", "luatex" and "xetex". If one of them creates file.fmt and another of them reads such file.fmt then the error message mentioned above occurs too. This is reason why TeX distributions save the generated file.fmt to directories specific for used TeX binary and they have implemented a searching system over such directory trees.