阅读:3602回复:5
error LNK2019: unresolved external symbol __ftol2
环境是 ddk 2003(只有这个 没有ddk xp)
程序没问题,以前的程序 现在build(xp 、2k都试了)就是这个链接错误 应该怎么设置环境才能解决呢? |
|
|
沙发#
发布于:2007-10-23 17:54
用户被禁言,该主题自动屏蔽! |
|
板凳#
发布于:2007-10-24 09:48
安装ddk2003完了在命令行中build
|
|
|
地板#
发布于:2007-10-24 10:11
用户被禁言,该主题自动屏蔽! |
|
地下室#
发布于:2007-10-24 10:28
build -cz 试过了,不行。
其实就是程序里用到了强制类型转换。lYFrame = (LONG) (lYPrintPage / 2.0); 这个错误我查了很多资料,可以肯定是包含的头文件和库文件不匹配导致的。 用vs2003编译vs6.0,或者装了psdk的编译6.0的程序,都会出这个问题。 msdn有写怎么回事,都是英文还没仔细看。 但ddk 2003的编译和环境设置用的都是他自带的。所以只要知道__ftol2要用哪个头文件和库文件就可以了,大不了我替换一下。 |
|
|
5楼#
发布于:2007-10-24 14:00
In VC6, casting a floating point number to a long caused the compiler to generate a call to a hidden library function named _ftol. VC7 generates a call to _ftol2 (obviously the implementation of this function changed, so the name was changed to prevent version clashes). If your source code includes a cast from double to long types, VC7 will generate a call to _ftol2, and the following linker error will result:
error LNK2001: unresolved external symbol __ftol2 Resolve this error by placing the following in one of your .cpp files (StdAfx.cpp, for example): #if (_MSC_VER >= 1300) && (WINVER < 0x0500) //VC7 or later, building with pre-VC7 runtime libraries extern "C" long _ftol( double ); //defined by VC6 C libs extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); } #endif |
|
|