Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your executable depends on its source code <em>and</em> another object, you need to link in the object as well. You can change your first (real) rule to something like (you may also need <code>HeatingUnit</code> stuff in both the dependency list and the <code>g++</code> command):</p> <pre><code>TempControlTest: TempControlTest.cpp BangBangControl.o g++ -o TempControlTest TempControlTest.cpp BangBangControl.o </code></pre> <p>You should also keep in mind that you may need dependencies on <em>header</em> files as well. Without that, a change to <code>BangBangControl.h</code> would not rebuild <code>BangBangControl.o</code> or <code>TempControlTest</code>.</p> <p>And, this is personal preference, I <em>always</em> make every rul depend on the <code>makefile</code> file as well so that, if I change the makefile, everything gets rebuilt automatically.</p> <p>Based on all your file contents, I would have something like:</p> <pre><code># Non-file rules (all is default). all: TempControlTest clean: rm -rf *.o TempControlTest # Build executable from all objects. TempControlTest: makefile TempControlTest.o BangBangControl.o HeatingControl.o g++ -o TempControlTest TempControlTest.o BangBangControl.o HeatingControl.o # Build objects from source (C and headers). TempControlTest.o: makefile TempControlTest.cpp BangBangControl.h g++ -c TempControlTest.cpp BangBangControl.o: makefile BangBangControl.cpp BangBangControl.h HeatingUnit.h g++ -c BangBangControl.cpp HeatingUnit.o: makefile HeatingUnit.cpp HeatingUnit.h g++ -c HeatingUnit.cpp </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      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