PBRT本来是在VS2003里编译发行的,现在工作时用2005.
设置好相关的环境变量以及Cygwin后,编译时会出现4个错误
错误 54 fatal error LNK1169: 找到一个或多个多重定义的符号
错误 52 error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 已经在 api.obj 中定义
错误 51 error LNK2005: "class std::basic_st
错误 50 error LNK2005: "class std::basic_string<char,struct std::ch
解决方法:
在core的项目属性里 --> 连接器 --> 命令行 里输入 /FORCE:MULTIPLE
具体可以参看MSDN对LNK1169的说明
重新编译,错误消失. 但警告数量由之前错误发生时的53个增加到143个
部分是由于函数在2005版本里面是deprecated,需要在原函数名后加_s,参数也需要变化
设置好相关的环境变量以及Cygwin后,编译时会出现4个错误
错误 54 fatal error LNK1169: 找到一个或多个多重定义的符号
错误 52 error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 已经在 api.obj 中定义
错误 51 error LNK2005: "class std::basic_st
错误 50 error LNK2005: "class std::basic_string<char,struct std::ch
解决方法:
在core的项目属性里 --> 连接器 --> 命令行 里输入 /FORCE:MULTIPLE
具体可以参看MSDN对LNK1169的说明
重新编译,错误消失. 但警告数量由之前错误发生时的53个增加到143个
部分是由于函数在2005版本里面是deprecated,需要在原函数名后加_s,参数也需要变化