我认为这是因为版权标志,但我找不到解决方案。
\documentclass[a4paper,12pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{xcolor}
\usepackage{listingsutf8}
\lstdefinestyle{customc}{
belowcaptionskip=1\baselineskip,
breaklines=true,
frame=L,
xleftmargin=\parindent,
language=C++,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{green!40!black},
commentstyle=\itshape\color{purple!40!black},
identifierstyle=\color{blue},
stringstyle=\color{orange},
}
\lstdefinestyle{customasm}{
belowcaptionskip=1\baselineskip,
frame=L,
xleftmargin=\parindent,
language=[x86masm]Assembler,
basicstyle=\footnotesize\ttfamily,
commentstyle=\itshape\color{purple!40!black},
}
\lstset{escapechar=@,style=customc}
\lstset{language=C++,texcl=true}
\lstset{inputencoding=utf8x}
\lstset{
numbers=left,
stepnumber=1,
firstnumber=1,
numberfirstline=true
}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{lstlisting}[caption={caption}, label={lst:ceb}]
//
// text
//
// Created by XX on YY
// Copyright © XX. All rights reserved.
//
#include <iostream>
#include <cmath>
#include <fstream>
#include <iomanip>
int main()
{
\\ some code
output.close();
return 0;
}
\end{lstlisting}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
此后我收到一个错误
答案1
改变
\lstset{inputencoding=utf8x}
到
\lstset{inputencoding=utf8}