[Tex/LaTex] Glossary does not work on different platforms

glossaries

I am writing my master thesis. When I compile and run the Tex file on Ubuntu everything works fine. When I do it on OSX and Windows it return the error:

Package glossaries Error: Glossary entry `...' has not been defined.

for all the \gls{} entries inserted.

I do follow the procedure for makeindex from the console. (makeindex main_body.glo -s main_body.ist -t main_body.glg -o main_body.gls).

Any hints?
thank you in advance.

Minimal Working Example

\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,
               footexclude,BCOR12mm,DIV13]{scrbook}
\input{components/info}
% include settings
\input{components/settings}
% include commands
\input{components/commands}

\makeindex
\makeglossary

\begin{document}    
    \frontmatter        
    \input{components/cover}
    \clearemptydoublepage
    \input{components/titlepage}
    \input{components/abstract}
    \tableofcontents
    \input{components/outline}
    \part[Introduction, Motivation and Backdrop]{Introduction, Motivation and Backdrop}     

    \part[Handbook and its Application]{Handbook and its Application}
    \part*{Appendix}
    \addcontentsline{toc}{part}{Appendix}

    \input{chapters/7_Glossary/Acronyms}
    \input{chapters/7_Glossary/Glossary}
    \glsaddall
    \printglossaries
    \addcontentsline{toc}{chapter}{Glossary and Acronyms}

    \clearemptydoublepage

    \bibliography{bibliography/literature}

\end{document}

Best Answer

This has nothing to do with the platform. The difference is due to using different versions of the glossaries package. You are basically using an entry before it's been defined. Here's a MWE:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\begin{document}

\gls{sample}

\newglossaryentry{sample}{name={sample},description={an example}}
\printglossary

\end{document}

The first time you compile this document, you get the error:

! Package glossaries Error: Glossary entry `sample' has not been defined.

With old (pre 3.08a) versions of glossaries, you will always get this error whenever you try to use an entry before it's been defined. With newer versions of glossaries, you'll get the error on the first LaTeX run, but not on subsequent runs (unless you delete the .glsdefs file). Therefore, I suspect that your Ubuntu platform has a fairly new version of glossaries, which is why it seems to work, whereas your other platform has an older pre-3.08a version, which is why it doesn't work.

The simplest, and recommended, solution is to define all your entries in the preamble.

Related Question