トップ 差分 一覧 ping ソース 検索 ヘルプ PDF 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に存在する関数群が欠落しているらしい。。。


 仕方がないので、以下のようなコーディングを行う(MFC)

SYSTEMTIME st;
GetSystemTime(&st);
CTime ct = CTime(st);
srand((unsigned)ct.GetTime());



YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto

Copyright© 矢木 浩人 All Rights Reserved.