Passing pointer to extern(C++) templated function

James Blachly james.blachly at gmail.com
Tue Oct 13 23:11:06 UTC 2020


On 10/13/20 5:23 AM, Jamie wrote:
> Building with:
> g++ -c a.cpp
> dmd main.d a.o
> 
> Throws the error:
> /usr/bin/ld: main.o: in function `_Dmain':
> main.d:(.text._Dmain[_Dmain]+0x31): undefined reference to `void 
> func3<int>(int*, int*)'
> /usr/bin/ld: main.d:(.text._Dmain[_Dmain]+0x3e): undefined reference to 
> `void func4<int>(int const*, int const)'
> collect2: error: ld returned 1 exit status
> Error: linker exited with status 1
> 

Is the template even instantiated? With just a template definition and 
an object file I am surprised you even have a symbol?


More information about the Digitalmars-d-learn mailing list