The easiest way to achieve this:
xgettext -o sample.pot -s a1.c a2.cpp sample.pot
You do not need -j , --join-existing , because xgettext accepts .po and .pot as regular input files.
The -j , --join-existing option is rarely useful. In combination with -D , --directory it causes the sample.pot output file used as the input file to not be executed in the directory list. If you use -lc , --language=c , you need -j , --join-existing , because sample.pot is otherwise parsed as the source C / C ++ file.
In addition, -o sample.pot , --output=sample.pot has the same effect as -d sample , --default-domain=sample . You can safely omit one of them.
source share