I'm working with TexMaker and I can't compile my documents because it apears de problem "Indefined control sequence", with the \usepackage{listings}. How do I fix it?
\documentclass[10pt]{article}
\usepackage{geometry}
\topmargin=15pt
\oddsidemargin=60pt
\textwidth=340pt
\textheight=545pt
\footskip=30pt
\usepackage{listings}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\rfoot{\thepage}
\usepackage[utf8]{inputenc}
\usepackage[spanish,activeacute]{babel}
\usepackage{marvosym}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\begin{document}
\begin{lstlisting}{Language={C++},caption= "Código en C++para resolver polinomios",frame=single,numbers=left]
const int N = 10;
double resolver(double[] polinomio, double x) {
double resultado = polinomio[0];
double potencia = x;
for (int i=1; i<N; i++) {
resultado+=polinomio[i]*potencia;
potencia = potencia*x;
}
return resultado;
}
\end{lstlisting}
\end{document}
Best Answer
There were several problems:
\usepackage
text."
]
instead of a}
to close the parameter list oflstlisting
.The following works: