Ask coding questions

← Back to all posts
How do I define template class functions in a separate C++ file?
nt998302 (159)

I've been inspired to make my own array class after using unreal engine for a while, but the compiler doesn't see the definitions of each function in the separate C++ file. I get an undefined error. How can I fix this?

Answered by theangryepicbanana (1598) [earned 5 cycles]
View Answer
theangryepicbanana (1598)

I had this problem a while back for my CS final, and you apparently can't have them in separate files unless you provide specific overloads for each type you use it for in the header file