error LNK2005 int __cdecl 解决方案【转】

error LNK2005: "int __cdecl isPtInPolygon(class std::vector<struct double2,class std::allocator<struct double2> > &,struct double2)" (?isPtInPolygon@@YAHAAV?$vector@Udouble2@@V?$allocator@Udouble2@@@std@@@std@@Udouble2@@@Z) already defined in _GlWidget.obj
1>Debug/StrokeBar.exe : fatal error LNK1169: one or more multiply defined symbols found

 

解决:
在 属性->配置属性->链接器->命令行中添加   /FORCE:MULTIPLE

 

这个选项告诉链接器去创建一个有效的exe文件或dll文件,即使一个函数或变量被引用,但多处定义。
这样生成的文件可能不会按照我们想象的那样执行。

posted @ 2016-10-27 11:24  hjlweilong  阅读(652)  评论(0编辑  收藏  举报