[cfe-users] Linking problem with implicit instantiation of constructor/destructor

krokus via cfe-users cfe-users at lists.llvm.org
Fri Apr 17 10:49:13 PDT 2020


> $ clang++ -o test main.cpp template.cpp
>
>> /usr/bin/ld: /tmp/main-e2fa2c.o: in function `main':
> main.cpp:(.text+0x2f): undefined reference to `Template<int>::Template()'
> /usr/bin/ld: main.cpp:(.text+0x4d): undefined reference to
> `Template<int>::~Template()'
> /usr/bin/ld: main.cpp:(.text+0x82): undefined reference to
> `Template<int>::~Template()'
>

What happens if you change the order of the .cpp files, putting
template.cpp first; is it stil unresolved?

clang++ -o test template.cpp main.cpp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20200417/e3f24537/attachment.html>


More information about the cfe-users mailing list