English Sentence Loading...............


error LNK2019: 无法解析的外部符号 __imp_time...

如果在用VC++写WinCE时,用到time(time_t *)这个比较经典的时间函数时,编译器会报出"error LNK2019: 无法解析的外部符号 __imp_time,该符号在函数……"的错误,在google上搜了很久,没什么进展.最后在国外的一个博客中找到了答案.
原文 (已被河蟹,需要翻墙)
引用内容 引用内容
If u got the following error when trying to compile an WindowCE application

"error LNK2019: unresolved external symbol __imp_time referenced in function"
that is because functions in time.h is not implemented on Window CE.
The problem is described below:
"Since my last post was time related, why not another? Don't worry too much about why this is on a Networking Blog even though it has nothing to do with networking. I own this stuff since there's a lot of technology in CE and not a ton of developers, so we get to cover all sorts of ground. And I'm not inclined to create a "cetime" blog to cover time related functions on CE :smile:.
Once in a while I'm asked on a newsgroup or internally someone wants to use a Unix style "time.h" function for whatever reason. The answer here is sorry, no, this isn't supported. In order to save resources (both ROM and developer), we decided only to implement Win32 time related functions.
However, it's not quite that simple. We do ship time.h in %_WINCEROOT%\public\ie\sdk\inc. This because some code we've ported from the desktop needs the time related structures, though it obviously can't use the Unix style functions declared in this file since they're not implemented anywhere. (The main data structure people use is tm, not to be confused with Toastmasters (which is a wonderful organization by the way).)
This causes problems for developers who are using Intellisense. Intellisense sees the C runtime functions defined in time.h and doesn't realize that they're not implemented, so people write code that calls into them and their code compiles but they get link errors. Understandably this is frustrating. The workaround here is obviously not to trust Intellisense for this particular case. For future versions, we're looking at removing time.h from this source place or at a minimum removing all the Unixy functions like time(), gmtime(), localtime(), etc... so Intellisense doesn't get confused.

原来是time.h在WinCE中不能用造成的.用CTime代替吧...

[本日志由 exgods 于 2009-08-28 00:55 AM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: WinCE LNK2019
相关日志:
评论: 1 | 引用: 0 | 查看次数: 3850
回复回复CTIme[2009-12-03 01:10 PM | del]
CTime好像也不行。。
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭