Cannot determine the size of the image [duplicate]

I have this code in LaTeX, I compile with "latex+dvips+ps2pdf+See PDF"

\documentclass[a4paper,12pt]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
\begin{figure} [h]
\centering
\includegraphics [width=8cm]{CircuitoRC.pdf}
\caption{Carga de un condensador en un circuito RC.}
\label{fig:circuito}
\end{figure}
\end{document}


In \includegraphics it says me this:

LaTeX Error: Cannot determine size of graphic in CircuitoRC.pdf (no BoundingBox).See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \includegraphics [width=8cm]{CircuitoRC.pdf}

I don't know why.

marked as duplicate by Schweinebacke, Stefan Pinnow, Troy, Mico, CarLaTeXJul 4 '17 at 8:09

• Can you directly use pdflatex to produce the pdf? Otherwise you will need your image in a format compatible with latex. – user36296 Jan 6 '17 at 18:36
• Latex does not support pdf files, it assure everything is eps and looks for a boundingbox string, then complaining it cannot find one. Use pdflatex instead. – daleif Jan 6 '17 at 18:44
• I have just tried with a .png image, same error – user122516 Jan 6 '17 at 18:46

When you are using LaTeX, that is in the commandline

 latex myfile


you only can use PostScript-File with \includegraphics. PostScript-files usually end in .ps or .eps. Using .pdf or .png will give the error.

 pdflatex myfile

In that case, you will be able to use \includegraphics with the following graphics files
1. JPEG-files ending in .jpg
2. Portable Network Graphics, ending in .png
3. PDF-files ending in .pdf
You should leave the file name ending. LaTeX will append them as listed above. This is, to have both an PostScript and an JPEG/PNG/PDF-file, which share the same file name and only differ in the file type and their corresponding file extension. So you could either run good old latex and include the .ps-file, while the younger pdflatex will search for the .jpg, .png and .pdf-file.