Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to link files in different folders produced by calling multiple make files?
    primarykey
    data
    text
    <p>I have the following make file</p> <pre><code>all: XmlNode.o y.tab.o y.tab.o lex.yy.o gcc -g -o prog y.tab.o lex.yy.o XmlAttributeNode.o XmlNode.o -ll -ly -lm XmlNode.o: cd XmlNode; make y.tab.o: y.tab.c gcc -g -c y.tab.c lex.yy.o: lex.yy.c gcc -g -c lex.yy.c y.tab.c: LexYacc/prog1.y bison -y -dv LexYacc/prog1.y lex.yy.c: LexYacc/prog1.l lex -l LexYacc/prog1.l clean: rm -f y.tab.* lex.yy.* *.o prog </code></pre> <p><code>XmlAttributeNode.o</code> and <code>XmlNode.o</code> are made in the <code>XmlNode</code> folder, thus I get the error </p> <pre><code>gcc: XmlAttributeNode.o: No such file or directory gcc: XmlNode.o: No such file or directory </code></pre> <p>I looked at the following questions <a href="https://stackoverflow.com/questions/1139271/makefiles-with-source-files-in-different-directories">1</a>, <a href="https://stackoverflow.com/questions/10044433/using-a-make-file-to-compile-files-in-separate-directories">2</a>, and <a href="https://stackoverflow.com/questions/341387/adding-a-directory-for-the-headers-in-a-makefile">3</a>, but I can't seem to find how I can get a list of all the .o files produced by XmlNode.o so 1) I don't have to type them by hand and 2) the proper path is included so gcc can find the .o files. So something like this:</p> <pre><code> XmlNode.o: cd XmlNode; XmlNodeList = .o files from this make; XmlPath = `pwd`; </code></pre> <p>and then:</p> <pre><code> all: XmlNode.o y.tab.o y.tab.o lex.yy.o gcc -g -o prog y.tab.o lex.yy.o XmlPath/XmlNodeList -ll -ly -lm </code></pre> <p>Any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload