www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Templates Instantiation error

reply yes9111 <yes9111 gmail.com> writes:
Hey Y'all,

I'm trying to write a simple utility class to read rows from a 
SQLite3 database using compile time parameters, but I've run into 
a weird problem.

https://pastebin.com/eTnbRjEd

If I try to instantiate a Reader class I'm hitting a linker error 
saying

Error 42: Symbol Undefined _sqlite3_open

But if I change the Reader definition to include a dummy template 
argument and instantiate it with any dummy type argument, the 
code compiles ok. Am I missing something?
Dec 15 2017
parent drug <drug2004 bk.ru> writes:
15.12.2017 11:49, yes9111 пишет:
 Hey Y'all,
 
 I'm trying to write a simple utility class to read rows from a SQLite3 
 database using compile time parameters, but I've run into a weird problem.
 
 https://pastebin.com/eTnbRjEd
 
 If I try to instantiate a Reader class I'm hitting a linker error saying
 
 Error 42: Symbol Undefined _sqlite3_open
 
 But if I change the Reader definition to include a dummy template 
 argument and instantiate it with any dummy type argument, the code 
 compiles ok. Am I missing something?
 
It isn't template instantiation error. Undefined symbol means you need link your executable with some library that contains this undefined symbol. In your case you need to link to libsqlite.so (linux) or sqlite.dll (windows).
Dec 15 2017