<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>I have am having trouble using template classes in rcpp. The compiling process works just fine, but there are errors on link. It seems as if the methods are not getting specialized.</div><div><br></div><div>The Error:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">** testing if installed package can be loaded</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">Error in dyn.load(file, DLLpath = DLLpath, ...) :&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">&nbsp; unable to load shared object '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so':</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">&nbsp; dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so, 6): Symbol not found: __ZN5gergm9BinaryNetINS_14DirectedVertexEE4sizeEv</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">&nbsp; Referenced from: /Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">&nbsp; Expected in: flat namespace</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">&nbsp;in /Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">Error: loading failed</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">Execution halted</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(252, 46, 17); ">ERROR: loading failed</div></div><div><br><div><br></div><div>The basic form of the class is:</div><div><br></div><div>template&lt;class T&gt;</div><div>class BinaryNet{</div><div>public:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>int size();</div><div>};</div><div><br></div><div>template&lt;class T&gt;</div><div>void&nbsp;BinaryNet&lt;T&gt;::size(){return 1;}</div><div><br></div><div>BinaryNet is called in a function in a separate c++ file. If I explicitly add the specialization, then everything works out fine</div><div><br></div><div><div>template&lt;&gt;</div><div>void&nbsp;BinaryNet&lt;DirectedVertex&gt;::size(){return 1;}</div></div><div><br></div><div>How can I make sure that these specializations are created. I apologize if this is more a c++ question than an Rcpp one.</div><div><br></div><div><br></div><div>Best,</div><div>Ian</div><div><br></div><div><br></div></div></body></html>