<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi,<div><br></div><div>I have a relatively simple SWIG - CMAKE project that is not linked correctly, source files can be downloaded here: <a href="https://drive.google.com/open?id=0B4Y0idbHnikgTUlocmQtNDY2czQ" target="_blank">https://drive.google.com/open?id=0B4Y0idbHnikgTUlocmQtNDY2czQ</a></div><div><br></div><div>The problem I have is if the template function Foo is implemented in the header file, the project compiles and works successfully. If Foo is instead implemented in the cpp file, the project compiles but fails either when linking on at runtime on Windows and Linux respectively.</div><div><br></div><div>On windows the build will fail at linking with "unresolved external symbols", as though the template function is not instantiated.</div><div><br></div><div>On Linux python fails to import the module with "undefined symbol".</div><div><br></div><div>If I build the projects by hand (not with CMake) they compile and link successfully, and run successfully.</div><div><br></div><div>Any suggestions?</div><div><br></div><div>Cheers,</div><div>Bruce</div></div></div></div>