# TeXstudio Compile: Error: Could not start the command: pdflatex.exe

I'm trying write a report in LaTeX but TeXstudio won't let me. All I have is this:

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}

\title{----}
\author{---\\By: ----}

\begin{document}

\maketitle
\paragraph{1}
\paragraph{2}
\subparagraph{Red}$\\$
\includegraphics{Red}
\subparagraph{Blue}$\\$
\includegraphics{Blue}

\end{document}


But when I click F1 to compile, TeXstudio spits this message:

Error: Could not start the command: pdflatex.exe -synctex=1 -interaction=nonstopmode "Prelab1".tex


What is the problem? Why can't I compile?

P.S: Ever since I switched from Ubuntu back to windows, writing LaTeX documents has been a massive pain T.T. What is the best LaTeX editor that won't give me a problem every single second?

-
Can you compile the file from the shell (i.e. pdflatex Prelab1)? Seems like you distribution is not correctly set up. –  Qrrbrbirlbel Feb 13 '13 at 22:37
@Qrrbrbirlbel i'm super new to latex so "compile the file from the shell" makes no sense to me. What exactly should I do? –  Richard Feb 13 '13 at 22:39
Shell means for Windows: Command line. Open up a window with one and cd to your TeX file and compile your document from there with pdflatex Prelab1. This tests if your TeX distribution is correctly installed at all. –  Qrrbrbirlbel Feb 13 '13 at 22:47

Check if the configuration is correct and that TexStudio points to the program binaries.

Wtih Windows PC: Options> Configure TeXstudio, select Build, option Default Compiler.

With OSX: texStudio > Preferences, select Build, option Default Compiler.

As for your question about the best editor, there is a Comparison of TeX editors documented on Wikipedia, which may be of use to you.

-
where is this quick build? This is what I see i.stack.imgur.com/rHtbU.png –  Richard Feb 13 '13 at 22:44
still don't see a quick build, i.stack.imgur.com/WZtFc.png –  Richard Feb 13 '13 at 22:48
I just edited my post. I hope the change helps. –  Umar Kalim Feb 13 '13 at 22:55
@UmarKalim again, on windows there is no quick build option –  Richard Feb 13 '13 at 22:57
@Richard, my apologies. I googled a bit and it seems that the options should be under the Build Tab, as is the case in the screenshot for OSX. Also, as suggested by @Qrrbrbirlbel, testing over the command line pdflatex PreLab1 would ensure that your TeX setup is functional. –  Umar Kalim Feb 13 '13 at 23:10

Another reason for getting this error with TexStudio (which is a wonderful IDE IMHO), is that it is really trying to tell you that the .tex file does not exist. This can happen, for example, when the wrong file has been chosen as the Master document. Check the error message to see that the file it mentions is the correct master. e.g.

pdflatex.exe -synctex=1 -interaction=nonstopmode "wrongfile".tex

-

I had the similar problem, but I solved it by change the path in Commands, see it in the picture. In it, you only need to correct the path to PdfLaTeX.

Hope this would help.

-

Well I am unable to comment on pdmadscience's comment. I just wanted to extend his response here. I had the same issue as the original poster and adding the pdflatex command (like pdmadscience suggested) fixed the issue. In the TexStudio documentation, they also add a few switches so that the full command looks like this:

"C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex" -synctex=1 -interaction=nonstopmode %.tex


(Assuming MikTek was installed in C:\Program Files)

You can also add C:\Program Files\MiKTeX 2.9\miktex\bin\x64\ to your PATH and replace "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex" with just pdflatex.

Here is the screenshot from the documentation:

-

I just installed TeXStudio and found I had the same issue. Running "Build and view" opened the view window, but nothing came up and the message I received was that the view failed because the pdf file did not exist. I read one of the other previous responses to this question, and thought I would build upon it with a little more detail: I looked in the configuration settings and found that the initial installer had not set up the vast majority of the commands:

I fixed the issue by pointing to the pdflatex.exe, with with my distribution was under

<Drive>:\Program files\Miktex 2.9\miktex\bin\x64\pdflatex.exe


If you do not find the file here, I would just search for "pdflatex" in windows.

-