Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>In theory, g++ should compile a class before the one that includes it.</p> </blockquote> <p>g++ should be able to <em>compile</em> your <em>source files</em> in any order it sees fit. The order it <em>includes</em> headers into your source is set by the order of your <code>#include</code> statements.</p> <p>The most likely case is that the class name is <code>room</code>, and not <code>Room</code>. Next likely is that the name is some other thing besides <code>Room</code>. Less likely is that it is in a namespace other than the root namespace.</p> <p>EDIT: Okay, if it's none of those, make sure that the <code>room.h</code> that is being included is your <code>room.h</code> and not some other <code>room.h</code>. Nothing like editing the wrong copy of a file to waste your day.</p> <p>EDIT 2: I'm assuming your header files have the usual include-once structure:</p> <pre><code>#ifndef schedule_h #define schedule_h // header file code goes here. #endif </code></pre> <p>... and that you omitted it for brevity.</p> <p>EDIT 3: I just copied the code you gave to a new directory, and created a dummy <code>day.h</code> file with the contents:</p> <pre><code>typedef int Day; </code></pre> <p>I then used <code>g++ -c -o schedule.o schedule.cpp</code> to build it and got no errors. Therefore the error is something we're not seeing.</p> <p>Edit 4: Okay, sanity check time. Look at the top of <code>room.h</code> and make sure it says</p> <pre><code>#ifndef room_h </code></pre> <p>and not</p> <pre><code>#ifdef room_h </code></pre>
 

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