链接器错误 - 未定义的符号

时间:2015-11-30 12:01:44

标签: visual-studio-2013 cmake qt5.5 log4cplus

问候语

我在log4cplus(1.2.0-rc3)中下载并编译了VS2013。编译很好(调试和发布)我试图在我的代码中使用它,但我收到很多链接错误,我尝试没有删除它们。我正在使用log4cplus项目中的相同包含,以及我编译的libs,我仍然可以得到这些。

1>------ Build started: Project: MYPROJECT, Configuration: Debug Win32 ------
1>utility.cpp.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>utility.cpp.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>device.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>path_tree.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>cim_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>pin_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>nautilus.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>ravis.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>ncr.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>wincore.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>atm_utility.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>banqit.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>grg.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>king_teller.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>supervisor_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>registry_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>device_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>atm_factory.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>database_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>user_interface.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)
1>fit_manager.obj : error LNK2001: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z)

我在这里缺少什么?!

提前致谢

1 个答案:

答案 0 :(得分:0)

发现问题!!

我必须在项目/Zc:wchar_t中将set_target_properties设置为CMakeLists.txt

set_target_properties(MYPROJECT PROPERTIES COMPILE_FLAGS "/W2 /Zc:wchar_t")