<div dir="ltr"><div>Hi,</div><div><br></div>I want to have some functions in my code inline so I use the <b>inline </b>keyword:<div><br></div><div><i><b>inline </b>void foo() {}</i></div><div><br></div><div>On some functions the compiler inlines the function but it fails to do so on other functions and thus I get a linkage error:</div>

<div><br></div><div><i>error: undefined reference to 'foo'</i><br></div><div><br></div><div>What are the conditions that make the compiler refuse inline?</div><div><br></div><div>Thanks,<br></div><div>David</div>
<div>
<br></div><div>p.s. I know that there are ways to pass compilation and let the compiler decide if to inline like using <i>__attribute__((always_inline))</i> but I must have the function inline.</div></div>