# Refer to label in another chapter (another file)

I am writing my thesis using LyX's thesis template, and each chapter is a different file (chapter-x.lyx).

However, sometimes, I need to refer to a section from another chapter, which is in a different file. So for example:

chapter-2.lyx:

this is explained further in chapter \ref{chap:White-Box-Testing}


chapter-3.lyx:

\begin_layout Chapter
White Box Testing
\begin_inset CommandInset label
LatexCommand label
name "chap:White-Box-Testing"


The problem is that when I generate the PDF document from Thesis.lyx, which has the pointers to all the chapter-x.lyx files, I get broken links in the output document.

How would I go about fixing this?

-

The problem is solved by setting the correct "master document": In each branched document (chapter-x.lyx), go to Document>Settings>Document Class.
Here, ensure that Select default master document is checked and the value is set to the filename referring to the main document from which all these other documents branch off. In my case, this document is Thesis.lyx and not the default thesis.lyx.