# “Undefined control sequence \includegraphics” after TeXstudio update [duplicate]

Undefined control sequence \includegraphics


but I couldn't find the answer to my problem in any of them. So here it goes.

I am trying to use the command \includegraphics, like I have always done so for the past years, but somehow it doesn't work anymore. I am using TeXstudio 2.12.16. Below is a MWE:

\documentclass[12pt]{article}
\usepackage[pdftex]{graphics,graphicx}

\begin{document}
\includegraphics[width=\linewidth]{photo.png}
\end{document}



When I try to compile, it returns the error

Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
Undefined control sequence. \includegraphics[width=\linewidth]{photo}
File photo' not found. \includegraphics[width=\linewidth]{photo}


I have made sure that the file photo is in the same directory.

This started happening after I updated TeXstudio, and it happens both in my laptop and desktop. I have reinstalled MiKTeX and TeXstudio countless times in both, but to no avail. I think TeXstudio is unable to detect the graphicx package somehow? The reason why I think it's because of TeXstudio is when I upload this project to Overleaf, there are no issues with it.

• Unrelated to the error: \usepackage[pdftex]{graphics,graphicx} should be a plain \usepackage{graphicx}. – campa Nov 7 '19 at 7:04
• Can you open the .log` file and copy the complete error message. The messages posted in the question seem to be the shortened versions displayed by your editor. Usually the messages are longer and indicate more clearly which command is undefined. Without seeing the error, my money would be on tex.stackexchange.com/q/511138/35864, but I can't be sure. Update MikTeX in Admin and User mode at least twice. – moewe Nov 7 '19 at 7:19
• Since texstudio is just editing text files and afterwards running latex on these, this issue have nothing to do with texstudio. As moewe states we'd like more information from the real log, not the filtered log that texstudio gives you as it often filters away important information. I agree with moewe, most likely an incomplete miktex update – daleif Nov 7 '19 at 7:24
• @moewe You were right, you can have your money back. It was indeed the same problem, I just had to update MikTeX – Bernardo Nov 7 '19 at 7:51
• Very good. In that case it would make sense to simply close this question here as a duplicate of tex.stackexchange.com/q/511138/35864. Do you agree? – moewe Nov 7 '19 at 7:58