wiiyourself1.15のデモプログラムのコンソールアプリケーションをフォームアプリケーションにしようとしていますが、以下のようなエラーが出ます。
wiiyourself:http://wiiyourself.gl.tter.org/
1>wiimote.obj : error LNK2028: 未解決のトークン (0A00014E) "extern "C" int __stdcall SetupDiDestroyDeviceInfoList(void *)" (?SetupDiDestroyDeviceInfoList@@$$J14YGHPAX@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A000151) "extern "C" unsigned long __stdcall timeGetTime(void)" (?timeGetTime@@$$J10YGKXZ) が関数 "private: static unsigned int __stdcall wiimote::SampleStreamThreadfunc(void *)" (?SampleStreamThreadfunc@wiimote@@$$FCGIPAX@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A000153) "extern "C" unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@$$J18YGEPAXPAU_HIDD_ATTRIBUTES@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A000156) "extern "C" int __stdcall SetupDiGetDeviceInterfaceDetailW(void *,struct _SP_DEVICE_INTERFACE_DATA *,struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W *,unsigned long,unsigned long *,struct _SP_DEVINFO_DATA *)" (?SetupDiGetDeviceInterfaceDetailW@@$$J224YGHPAXPAU_SP_DEVICE_INTERFACE_DATA@@PAU_SP_DEVICE_INTERFACE_DETAIL_DATA_W@@KPAKPAU_SP_DEVINFO_DATA@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A000157) "extern "C" int __stdcall SetupDiEnumDeviceInterfaces(void *,struct _SP_DEVINFO_DATA *,struct _GUID const *,unsigned long,struct _SP_DEVICE_INTERFACE_DATA *)" (?SetupDiEnumDeviceInterfaces@@$$J220YGHPAXPAU_SP_DEVINFO_DATA@@PBU_GUID@@KPAU_SP_DEVICE_INTERFACE_DATA@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A000158) "extern "C" void * __stdcall SetupDiGetClassDevsW(struct _GUID const *,wchar_t const *,struct HWND__ *,unsigned long)" (?SetupDiGetClassDevsW@@$$J216YGPAXPBU_GUID@@PB_WPAUHWND__@@K@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A000159) "extern "C" void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@$$J14YGXPAU_GUID@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A00015C) "extern "C" unsigned int __stdcall timeEndPeriod(unsigned int)" (?timeEndPeriod@@$$J14YGII@Z) が関数 "public: virtual __thiscall wiimote::~wiimote(void)" (??1wiimote@@$$FUAE@XZ) で参照されました。
1>wiimote.obj : error LNK2028: 未解決のトークン (0A00015F) "extern "C" unsigned int __stdcall timeBeginPeriod(unsigned int)" (?timeBeginPeriod@@$$J14YGII@Z) が関数 "public: __thiscall wiimote::wiimote(void)" (??0wiimote@@$$FQAE@XZ) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" unsigned int __stdcall timeBeginPeriod(unsigned int)" (?timeBeginPeriod@@$$J14YGII@Z) が関数 "public: __thiscall wiimote::wiimote(void)" (??0wiimote@@$$FQAE@XZ) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" unsigned long __stdcall timeGetTime(void)" (?timeGetTime@@$$J10YGKXZ) が関数 "private: static unsigned int __stdcall wiimote::SampleStreamThreadfunc(void *)" (?SampleStreamThreadfunc@wiimote@@$$FCGIPAX@Z) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" unsigned int __stdcall timeEndPeriod(unsigned int)" (?timeEndPeriod@@$$J14YGII@Z) が関数 "public: virtual __thiscall wiimote::~wiimote(void)" (??1wiimote@@$$FUAE@XZ) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" int __stdcall SetupDiDestroyDeviceInfoList(void *)" (?SetupDiDestroyDeviceInfoList@@$$J14YGHPAX@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@$$J18YGEPAXPAU_HIDD_ATTRIBUTES@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" int __stdcall SetupDiGetDeviceInterfaceDetailW(void *,struct _SP_DEVICE_INTERFACE_DATA *,struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W *,unsigned long,unsigned long *,struct _SP_DEVINFO_DATA *)" (?SetupDiGetDeviceInterfaceDetailW@@$$J224YGHPAXPAU_SP_DEVICE_INTERFACE_DATA@@PAU_SP_DEVICE_INTERFACE_DETAIL_DATA_W@@KPAKPAU_SP_DEVINFO_DATA@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" int __stdcall SetupDiEnumDeviceInterfaces(void *,struct _SP_DEVINFO_DATA *,struct _GUID const *,unsigned long,struct _SP_DEVICE_INTERFACE_DATA *)" (?SetupDiEnumDeviceInterfaces@@$$J220YGHPAXPAU_SP_DEVINFO_DATA@@PBU_GUID@@KPAU_SP_DEVICE_INTERFACE_DATA@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" void * __stdcall SetupDiGetClassDevsW(struct _GUID const *,wchar_t const *,struct HWND__ *,unsigned long)" (?SetupDiGetClassDevsW@@$$J216YGPAXPBU_GUID@@PB_WPAUHWND__@@K@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
1>wiimote.obj : error LNK2019: 未解決の外部シンボル "extern "C" void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@$$J14YGXPAU_GUID@@@Z) が関数 "public: bool __thiscall wiimote::Connect(unsigned int,bool)" (?Connect@wiimote@@$$FQAE_NI_N@Z) で参照されました。
どのように解決すればよろしいでしょうか?
コンソールアプリケーションだったらビルドできるのでしょうか?
# できなさそうな気がしますが……
ReadMe.txtに下記の記述がありますが、インストールされています?
> - The Windows Driver Development Kit (WDK or DDK) is required to
> build (for the HID API). It's a free download from MS page
> (no need to register). Currently it's found here (or search
> for it on microsoft.com):
winmm.libも読めていないようですが…環境正しく設定されていますか?
早速の回答ありがとうございます。
Demoプログラムは下記のページを参考にしてなんとかビルド、動作しました。
http://d.hatena.ne.jp/AngelBeats/20100624/1277370599
環境は大丈夫のはずです。
フォームアプリケーションは新規で作成し、そこにDemoで使われているライブラリやソースファイルをとりあえず入れたのですが、
エラーが多くて・・・
そんな雑な方法ではダメでしょうか?
開発環境はVisual Studio 2008 VC++です。
多分winmm.libを含むいくつかのライブラリのリンクを忘れてますね。
プロジェクトのプロパティを「動いた」プロジェクトと同じにしましたか。
wiimote.cppで
# pragma comment(lib, "setupapi.lib")
# pragma comment(lib, "hid.lib")
# pragma comment(lib, "winmm.lib")
って感じに指定されていますけど……。
とりあえず、上記のファイル名をリンカの追加のライブラリに書いてみてはどうでしょう?
>とりあえず、上記のファイル名をリンカの追加のライブラリに書いてみてはどうでしょう?
上記の通りにしてみたら、エラー無く動作することができました。
こんな質問にみなさま親身に答えてくださり、
本当にありがとうございました。
問題解決しました。
工学ナビってサイトの紹介でARを試そうとしたら以下のようなエラーがでました。
紹介道理に設定してエラーがでたため初心者の自分にはよく分かりません。
環境はVC++2008無償版です。
「ARでタチコマ AR_Tachikoma.zip」ってソースをそのままビルドしました。
エラー 10 error LNK2028: 未解決のトークン (0A00004B) "void __cdecl GetControllerData(struct CONTROLLER_DATA *)" (?GetControllerData@@$$FYAXPAUCONTROLLER_DATA@@@Z) が関数 "void __cdecl `anonymous namespace'::CalcState(void)" (?CalcState@?A0x7f6650a9@@$$FYAXXZ) で参照されました。 main.obj
エラー 11 error LNK2028: 未解決のトークン (0A000063) "extern "C" void __cdecl mqoDeleteModel(struct MQO_OBJECT *)" (?mqoDeleteModel@@$$J0YAXPAUMQO_OBJECT@@@Z) が関数 "void __cdecl `anonymous namespace'::Cleanup(void)" (?Cleanup@?A0x7f6650a9@@$$FYAXXZ) で参照されました。 main.obj
エラー 12 error LNK2028: 未解決のトークン (0A000067) "extern "C" void __cdecl mqoCallModel(struct MQO_OBJECT *)" (?mqoCallModel@@$$J0YAXPAUMQO_OBJECT@@@Z) が関数 "void __cdecl `anonymous namespace'::DrawObject(unsigned char *)" (?DrawObject@?A0x7f6650a9@@$$FYAXPAE@Z) で参照されました。 main.obj
エラー 13 error LNK2028: 未解決のトークン (0A000075) "extern "C" void __cdecl mqoInit(void)" (?mqoInit@@$$J0YAXXZ) が関数 "int __cdecl main(int,char * *)" (?main@@$$HYAHHPAPAD@Z) で参照されました。 main.obj
エラー 15 error LNK2028: 未解決のトークン (0A000094) "extern "C" struct MQO_OBJECT * __cdecl mqoCreateModel(char *,double)" (?mqoCreateModel@@$$J0YAPAUMQO_OBJECT@@PADN@Z) が関数 "int __cdecl main(int,char * *)" (?main@@$$HYAHHPAPAD@Z) で参照されました。 main.obj
エラー 16 error LNK2019: 未解決の外部シンボル "extern "C" void __cdecl mqoCleanup(void)" (?mqoCleanup@@$$J0YAXXZ) が関数 "void __cdecl `anonymous namespace'::Cleanup(void)" (?Cleanup@?A0x7f6650a9@@$$FYAXXZ) で参照されました。 main.obj
エラー 17 error LNK2019: 未解決の外部シンボル "extern "C" void __cdecl mqoDeleteModel(struct MQO_OBJECT *)" (?mqoDeleteModel@@$$J0YAXPAUMQO_OBJECT@@@Z) が関数 "void __cdecl `anonymous namespace'::Cleanup(void)" (?Cleanup@?A0x7f6650a9@@$$FYAXXZ) で参照されました。 main.obj
エラー 18 error LNK2019: 未解決の外部シンボル "void __cdecl GetControllerData(struct CONTROLLER_DATA *)" (?GetControllerData@@$$FYAXPAUCONTROLLER_DATA@@@Z) が関数 "void __cdecl `anonymous namespace'::CalcState(void)" (?CalcState@?A0x7f6650a9@@$$FYAXXZ) で参照されました。 main.obj
エラー 19 error LNK2019: 未解決の外部シンボル "extern "C" void __cdecl mqoCallModel(struct MQO_OBJECT *)" (?mqoCallModel@@$$J0YAXPAUMQO_OBJECT@@@Z) が関数 "void __cdecl `anonymous namespace'::DrawObject(unsigned char *)" (?DrawObject@?A0x7f6650a9@@$$FYAXPAE@Z) で参照されました。 main.obj
エラー 20 error LNK2019: 未解決の外部シンボル "extern "C" struct MQO_OBJECT * __cdecl mqoCreateModel(char *,double)" (?mqoCreateModel@@$$J0YAPAUMQO_OBJECT@@PADN@Z) が関数 "int __cdecl main(int,char * *)" (?main@@$$HYAHHPAPAD@Z) で参照されました。 main.obj
エラー 26 fatal error LNK1120: 外部参照 16 が未解決です。 C:\Documents and Settings\NAKAMURA\My Documents\Visual Studio 2008\Projects\cc09414\Debug\cc09414.exe
>「ARでタチコマ AR_Tachikoma.zip」ってソースをそのままビルドしました。
http://kougaku-navi.net/koukaku.html
ですかね?
そのままビルドしたとすると、「main.obj」が作られることはない…ハズですけど?
# main.cもmain.cppもありませんし。
ということで、プロジェクト内に入っているmain.c/main.cppにどんなコードを書いているのか…が問題かと思われます。
プロジェクトとしては…「Win32コンソール アプリケーション」で「空のプロジェクト」を作成。
各ファイルをプロジェクトに追加して、文字コードを「マルチバイト 文字セットを使用」に変更。
「追加のインクルードディレクトリ」や「追加のライブラリディレクトリ」にARToolkit関連のディレクトリを指定する必要がある…ようです。
便乗なのかも知れませんが…
こういう場合は新たに質問立てた方がよいかと思われますけど。
# ついでに「工学ナビ」のサイトにも掲示板ありますが…
ツイート | ![]() |