- ベストアンサー
VC++2008のC2664エラー
- VC++2008で、現在手を出しているARToolKitを利用したプログラムです。
- C2664というエラーが発生し、その解決方法がよくわからないので質問します。
- 「*cparam」が「char **からARParam *へ変換できない」と言うものなのですがどうすれば解決できるでしょうか。
- みんなの回答 (1)
- 専門家の回答
質問者が選んだベストアンサー
関連するQ&A
- error C2664
現在VisualStudio C++ 6.0にてプログラムを組んでいるのですが、以下のようなエラーが出ます。 型の変換ができていないであろうことはわかるのですが、解決方法がわかりません。 どのような解決方法があるのでしょうか? よろしくお願いします。 error C2664: 'strcat' : 1 番目の引数を 'unsigned char [256]' から 'char *' に変換できません。 (新しい機能 ; ヘルプを参照) 指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
- ベストアンサー
- C・C++・C#
- 意味がわからないエラーがあります【14歳からはじめるC言語ゲームプログラミング】
14歳からはじめるC言語ゲームプログラミング(横スクロールアクションゲーム)をやっていて、第5章で意味がわからないエラーがでました・・・ error C2664: 'MessageBoxW' : 2 番目の引数を 'const char [25]' から 'LPCWSTR' に変換できません。 1> 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。 というもので、chap4.cppの23行目と67行目でひっかかりました。 どうすれば解決できますでしょうか。 C言語に詳しい方、よろしくおねがいします。
- 締切済み
- C・C++・C#
- VC++でコンパイルエラーが出ますがお教えください。
初心者で申し訳なくおもいます。 下記のソースでコンパイルエラーが出ます。 // CnstDst.cpp : アプリケーション用のエントリ ポイントの定義 // #include "stdafx.h" //CnstDst クラス定義 class CnstDst { char sDat[80]; public: CnstDst(char *s); ~CnstDst(); }; CnstDst cd1("テストです"); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // TODO: この位置にコードを記述してください。 MessageBox(NULL, "WinMainの入口", "WinMain", MB_OK); CnstDst cd2("テスト1"); MessageBox(NULL, "テスト2", "WinMain", MB_OK); return 0; } CnstDst::CnstDst(char *s) { lstrcpy(sDat, s); MessageBox(NULL, sDat, "コンストラクタ", MB_OK); } CnstDst::~CnstDst() { MessageBox(NULL, sDat, "デストラクタ", MB_OK); } コンパパイルエラーは下記です。 プロジェクト 'CnstDst - Win32 (WCE MIPSII_FP) Debug' 用の中間ファイルおよび出力ファイルを削除しています。 --------------------構成 : CnstDst - Win32 (WCE MIPSII_FP) Debug-------------------- リソースをコンパイル中... コンパイル中... StdAfx.cpp コンパイル中... CnstDst.cpp C:\Documents and Settings\中野\デスクトップ\テストフォルダ\CnstDst\CnstDst.cpp(22) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [14]' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\テストフォルダ\CnstDst\CnstDst.cpp(24) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [9]' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\テストフォルダ\CnstDst\CnstDst.cpp(31) : error C2664: 'wcscpy' : cannot convert parameter 1 from 'char [80]' to 'unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\テストフォルダ\CnstDst\CnstDst.cpp(32) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [80]' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\テストフォルダ\CnstDst\CnstDst.cpp(36) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [80]' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast clmips.exe の実行エラー CnstDst.exe - エラー 5、警告 0 Microsoft eMbedded Visuai C++ Win32 WCE で行っております。
- ベストアンサー
- C・C++・C#
- エラー C2664
プログラミングの初心者です. 「error C2664: 'fclose' : 1 番目の引数を 'const char [14]' から 'FILE *' に変換できません。 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。」 以上のエラー文がでてきて, http://tipstips.client.jp/ugopen/UfuncErrorW32.html ↑の操作をしても消えませんでした. エラー文の出てきたのは fclose("sikisaizu.csv"); というところです. よければヒント等を教えていただけると嬉しく思います. よろしくお願い致します.
- ベストアンサー
- C・C++・C#
- SDKでのエラーなのですが。
はじめまして。 SDKの勉強で猫でもわかる~のHPの第37章のサンプルを実行したのですが、 --------------------構成: 037 - Win32 Debug-------------------- コンパイル中... main.cpp D:\SDK\037\main.cpp(230) : error C2664: 'CallWindowProcA' : 1 番目の引数を 'int (__stdcall *)(void)' から 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)' に変換できません。 (新しい機能 ; ヘルプを参照) この変換には reinterpret_cast, C スタイル キャストまたは関数スタイルのキャストが必要です。 D:\SDK\037\main.cpp(248) : error C2664: 'CallWindowProcA' : 1 番目の引数を 'int (__stdcall *)(void)' から 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)' に変換できません。 (新しい機能 ; ヘルプを参照) この変換には reinterpret_cast, C スタイル キャストまたは関数スタイルのキャストが必要です。 cl.exe の実行エラー 037.exe - エラー 2、警告 0 というようなエラーが出てしまいました。 このエラーを回避するにはどのようにすればいいのでしょうか?
- ベストアンサー
- C・C++・C#
- Visual C++
超ド素人でVisual C++の入門本を開けたばかりなのですが、いきなりつまずいてしまいました。 本に書いてあるプログラムをコピーしてビルドしてもエラーが出ます。 「error C2664: 'lstrcpyW' : 1 番目の引数を 'char [80]' から 'LPWSTR' に変換できません。(新しい機能 ; ヘルプを参照) 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。」 と出ます。書籍はVC++5.0/6.0対応で、使っているのはVisual Studio2005のVC++です。バージョンが違うのでエラーが出るのでしょうか?
- ベストアンサー
- C・C++・C#
- C言語のキャスト
キーボード操作で見たい画像を切り替えるというプログラムを作成しようとしているのですがエラーが起きてしまい出来ません。 例えば、キーボードで「a」と押せばAの画像が出るように文字列にAの画像のファイル名を代入して画像を表示させようと思ったのですが、 const char [2]' から 'char' に変換できません。 この変換には reinterpret_cast, C スタイル キャストまたは関数スタイルのキャストが必要です。 というエラーが出てきます。 キャストという言葉は聞いたことがあるのですが、よくわかりません。 だれか教えてください。お願いします。
- ベストアンサー
- C・C++・C#
- VC++にてCString型のフルパスをfopenする
VC++(VisualStudio2005)にてCString型のフルパスをfopenしたいと思っています。 他ページでは char *name = new char[filepass.GetLength()+1]; strcpy( name, filepass ); でstrcpyでCstring→charへ変換できるとあったのですが、 'strcpy' : 2 番目の引数を 'CString' から 'const char *' に変換できません。(新しい機能 ; ヘルプを参照) 1> この変換を実行可能なユーザー定義変換演算子がないか、または演算子を呼び出せません。 というエラーをはいて実行できませんでした。 lstrcpy(name, filepass)でも 1 番目の引数を 'char [100]' から 'LPWSTR' に変換できません。(新しい機能 ; ヘルプを参照) 1> 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。 となりました。 何か良い方法をご存じないですか? char型に変換できなくとも、結果的にfopenを使ってファイルオープンできれば良いです。
- ベストアンサー
- C・C++・C#
- コンパイルエラーが理解できません
初心者ですお教えください。 下記ソースをMicrosoft eMbedded Visual C++ でコンパイルしましたがコンパイルエラーが出て 理解できませんどなたかお教えください。 STANDARDSDK Win32 (WCE x86)Debug STANDARDSDK Emulator -------------------------------------------------- #include "windows.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { SYSTEMTIME tm; char s[80]; int iRet; // 現在時刻を取得します。 GetLocalTime(&tm); // 表示する文字列を設定します。 if ((tm.wHour >= 0) && (tm.wHour < 12)) { lstrcpy(s, "おはです。"); } else if (tm.wHour < 17) { lstrcpy(s, "こんちは。"); } else { lstrcpy(s, "こんば。"); } // メッセージボックスに文字列を表示します。 iRet = MessageBox(NULL, s, "MsgBox", MB_OK); // 正常終了を意味する戻り値を返します。 return 0; } <コンパイルエラー内容です> プロジェクト 'MsgMain - Win32 (WCE x86) Debug' 用の中間ファイルおよび出力ファイルを削除しています。 --------------------構成 : MsgMain - Win32 (WCE x86) Debug-------------------- コンパイル中... MsgMain.cpp C:\Documents and Settings\中野\デスクトップ\MsgMain.cpp(7) : error C2731: 'WinMain' : function cannot be overloaded C:\Documents and Settings\中野\デスクトップ\MsgMain.cpp(3) : see declaration of 'WinMain' C:\Documents and Settings\中野\デスクトップ\MsgMain.cpp(17) : error C2664: 'wcscpy' : cannot convert parameter 1 from 'char [80]' to 'unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\MsgMain.cpp(19) : error C2664: 'wcscpy' : cannot convert parameter 1 from 'char [80]' to 'unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\MsgMain.cpp(21) : error C2664: 'wcscpy' : cannot convert parameter 1 from 'char [80]' to 'unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast C:\Documents and Settings\中野\デスクトップ\MsgMain.cpp(25) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [80]' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast cl.exe の実行エラー MsgMain.exe - エラー 5、警告 0 以上です宜しくお願いします。
- ベストアンサー
- C・C++・C#
- strcpyについて
strcpyでコピーしたものを配列に入れていきたいのですが、やってみると 「'=' : 'char *' から 'char' に変換することはできません。この変換には reinterpret_cast, C スタイル キャストまたは関数スタイルのキャストが必要です。」とエラーが出ました。 strcpyでコピーしたものを配列に入れることはできないのですか?
- ベストアンサー
- C・C++・C#
お礼
遅くなってしまいましたが、回答ありがとうございました。 確認してみたところ自分がとんでもない勘違いをしていたようです。 ありがとうございました。