Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm guessing you're missing one of the following:</p> <pre><code>// FILE: MyHeader1.hpp #ifndef MyHeader1_hpp // sentinel #define MyHeader1_hpp ...your header code... #endif </code></pre> <p>Those sentinels should be on <em>all</em> headers, and typically in all template implementation files to guard against duplicate inclusion when you cannot anticipate order (almost never can it be anticipated).</p> <p>(Some people prefer <code>"#pragma once</code>" over the sentinels, but since that's not in the C++ standard, I'm not a fan, even though it pretty much works cross-platform.)</p> <p>...OR...</p> <p>Do not forget, headers <em>must compile to size zero</em>.</p> <p>DO NOT:</p> <pre><code>// FILE: MyHeader1.hpp #ifndef MyHeader1_hpp #define MyHeader1_hpp int my_global; // NO! NOT IN A HEADER! extern int my_global; // Fine, instantiate in the *.cpp #endif </code></pre> <p>Headers contain interface definitions permitting the single-pass compiler to establish type sizes and interface "hook-ups" across modules. They SHOULD NOT contain logic or state that compiles to greater-than-zero-bytes (that is the purpose of the *.cpp files).</p> <p>A minor (but interesting) exception is template meta-programming, which can be done (pretty much) entirely in headers, with the compiler generating all the source code as the templates are "used" (but the templates themselves still compile to "size zero", and thus are fine for headers -- and typically <em>must</em> be defined in headers).</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.
    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.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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