在VC++的一段程序中碰到一大堆的链接错误:
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::Init(void)" ()" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::ios_base::Init::~Init(void)" ()" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::_Winit(void)" ()" imported
LINK : warning LNK4049: locally defined symbol ""public: __thiscall std::_Winit::~_Winit(void)" ()" imported
LINK : warning LNK4049: locally defined symbol ""public: class std::basic_ostream > & __thiscall std::basic_ostream >::operator<<(class std::basic_ostreamaits > & (__cdecl*)(class std::basic_ostream > &))" ()" imported
LINK : warning LNK4049: locally defined symbol ""class std::basic_ostream > & __cdecl std::operator<<(class std::basic_ostream > &,char const *)" (?
)" imported
LINK : warning LNK4049: locally defined symbol ""class std::basic_ostream > std::cerr" ()" imported
LINK : warning LNK4049: locally defined symbol ""class std::basic_ostream > & __cdecl std::endl(class std::basic_ostream > &)" (
)" imported
LINK : warning LNK4049: locally defined symbol "_atoi" imported
LINK : warning LNK4049: locally defined symbol "__assert" imported
CreateRtPlanDlg.obj : error LNK2001: unresolved external symbol __imp__atof
Debug/CreateRtPlan.exe : fatal error LNK1120: 1 unresolved externals
解决过程:
(1)原因明显是自己使用了:atoi 和atof 这两个函数,但是搜索MSDN,自己也已经增加了 and 啊,按道理不应该有错,可还是出问题。
(2)google上搜了一会儿,发现可能是
“maybe you're using the wrong "runtime-library". If you're compiling
QT as multithreaded, maybe you should use the "Multithreaded Run-Time
library" as well (in Visual C++ under Project->Settings->C/C++->Code
Generartion).”
(3)于是对比了一下类似的工程,将Visual C++ under Project->Settings->C/C++->Code
Generartion 中的“Debug MultiThreaded DLL”改成了“Debug MultiThreaded” ,就一切OK!
(4)对VC++编译环境的理解还是不够,更清楚的原因以后再去找吧。
阅读(9005) | 评论(1) | 转发(0) |