这个博客立方建议尝试四件事,然后或多或少地寻求帮助
- 重建,检查
- 检查运行时库,只有一个项目
- 检查入口点,检查 SUBSYSTEM:CONSULE
- 检查强制包含的 .lib 文件,我没有看到 #pragma comment(lib, ...)
- 关于在链接器选项中打开 /VERBOSE 的东西,我没有看到该选项
我会发布一些代码,但这是一个 LNK 错误;它没有提供太多信息。
- LNK2005:“类 std::vector,类 std::allocator >,类 std::allocator,类 std::allocator > > >,类 std::allocator,类 std::allocator >,类 std::allocator,类 std::allocator > > > > > list1" (?list1@@3V?$vector@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2 @@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$allocator@ V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@ std@@V?$allocator@D@2@@std@@@2@@std@@@2@@std@@A) 已在 msproject.obj 中定义
- LNK2005:“类 std::vector,类 std::allocator >,类 std::allocator,类 std::allocator > > >,类 std::allocator,类 std::allocator >,类 std::allocator,类 std::allocator > > > > > list1" (?list1@@3V?$vector@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2 @@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$allocator@ V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@ std@@V?$allocator@D@2@@std@@@2@@std@@@2@@std@@A) 已在 msproject.obj 中定义
我看到它与 msproject 中已经定义的向量有关 - 我确保向量具有不同的名称。这是与标题有关的东西吗# include <vector>
?我尝试注释掉一些#includes 以检查,但相同。