トップ 一覧 ping 検索 ヘルプ RSS ログイン

Windows Mobile 6 VisualStudio2005 で time 関数が使えないの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!!!Windows Mobile 6 VisualStudio2005 で time 関数が使えない
[Windows Mobile][Visual Studio 2005]

!!time関数が使えない
::乱数を生成しようと、以下のようなソースを記述するも、

 #include <time.h>
      :
 srand( (unsigned)time( NULL ) );
      :
 int ope1 = rand() % mn;

::LNK2019 エラー発生
 error LNK2019: 未解決の外部シンボル time が関数 "public: class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsOS<wchar_t> > > __cdecl CompPractice::nextPractice(void)" (?nextPractice@CompPractice@@QAA?AV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsOS@_W@ATL@@@@@ATL@@XZ) で参照されました。

!!どうも[Windows CE用のVisual C++の標準関数には、time.tに存在する関数群が欠落している|http://netlog.jpn.org/r271-635/2008/05/windows_ce_timet.html]らしい。。。
*http://netlog.jpn.org/r271-635/2008/05/windows_ce_timet.html
*http://blog.goo.ne.jp/yuki90r/e/f4604225eac392b550d7a31430f19bc2
*http://outside.samuson.com/mtblog/windows_mobile/

!!仕方がないので、以下のようなコーディングを行う
!!仕方がないので、以下のようなコーディングを行う(MFC)
 SYSTEMTIME st;
 GetSystemTime(&st);
 CTime ct = CTime(st);
 srand((unsigned)ct.GetTime());