English Sentence Loading...............
error LNK2019: 无法解析的外部符号 __imp_time...
作者:exgods 日期:2009-07-05
如果在用VC++写WinCE时,用到time(time_t *)这个比较经典的时间函数时,编译器会报出"error LNK2019: 无法解析的外部符号 __imp_time,该符号在函数……"的错误,在google上搜了很久,没什么进展.最后在国外的一个博客中找到了答案.
原文 (已被河蟹,需要翻墙)
引用内容
原来是time.h在WinCE中不能用造成的.用CTime代替吧...
原文 (已被河蟹,需要翻墙)
引用内容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.
"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代替吧...
评论: 1 | 引用: 0 | 查看次数: 3850
CTime好像也不行。。
发表评论







上一篇
下一篇

文章来自:
Tags:
相关日志:
回复