Skip to content
Prev 6372 / 10988 Next

[Rcpp-devel] multiple definition problem

On 24 Aug 2013 at 09:04, romain at r-enthusiasts.com wrote:
Another alternative is simply to declare such a function as "inline." 

This does not mean that it will be physically inlined -- it may or may not
be, at the discretion of the compiler; it only means that the compiler/linker
are responsible for eliminating multiple definitions, ie it simply makes it 
legal for the function to be defined in multiple compilation units, "as if" it 
were inline.

Include guards won't prevent multiple definition errors when the same header 
is included by multiple compilation units. Any function defined in a header file, 
which is not in a class definition, and is not a template, should be 
declared as inline.

Steve Jaffe
steve_jaffe at yahoo.com