楼主:
xie29 (xie29)
2017-04-30 15:48:11开发平台(Platform): (Ex: Win10, Linux, ...)
macos
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
xcode
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
各位大大好,小弟为c++的初学者,现在正在看c++ primer(3rd),在template编译模组时碰到了一点问题
,我的目的是想要将template的宣告和定义分开,但编译一直给我linker error的讯息,有去google了但
原因我还是看不太懂(抱歉我太菜了...),但有试过他们提供的解决方法都有效,但还是想知道为什么无法
执行..感谢!
喂入的资料(Input):
预期的正确结果(Expected Output):
错误结果(Wrong Output):
Undefined symbols for architecture x86_64:
"int mmm<int>(int, int)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
程式码(Code):(请善用置底文网页, 记得排版)
//File:Min.hpp
#ifndef _MIN
#define _MIN
template <class Type>
extern Type _min(Type , Type);
#endif