When implementing a standalone function inside a header file, it gives an error "Error 4 fatal error LNK1169: one or more multiply defined symbols found" whereas standalone template functions and member functions of a class work fine when implemented inside a header file.
Is the normal standalone function needed to be defined as an inline function? can anybody give me a clear explanation why?
Every time you include it - it gets redefined into that object file
an inline function allows this because it isn't a linker object
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.