Time () is not supported in WinCE ()

Source: Internet
Author: User

Actually, Windows does not support time () calls. Lib is not implemented,
It took three hours to find out today, a waste of time.

The current method is to call ctime: getcurrenttime () or Windows API getsystemtime ()

 

 

If you use time (time_t *), a classic time function written in VC ++, the compiler reports "error lnk2019: an external symbol that cannot be parsed _ imp_time, this symbol is in the function ...... "The error was found on Google for a long time and there was no progress. Finally, I found the answer in a foreign blog.

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 intelliisense. intelliisense sees the C runtime functions defined in time. H and doesn't realize that they're not implemented, so people write code that callinto them and their Code compiles but they get Link errors. understandably this is frustrating. the workaround here is obviusly not to trust intelliisense for this particle case. for future versions, we're looking at removing time. h from this source place or at a minimum removing all the unixy funxy like time (), gmtime (), localtime (), Etc... so intelliisense doesn' t get confused.

It turns out that time. h cannot be used in wince. Use ctime instead...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.