【VC++エラー解決法】初心者向け コンパイルエラーの対処方法を紹介

このQ&Aのポイント
  • VC++でコンパイルエラーが発生しています。初心者の方に向けて、エラーの内容と解決方法を詳しく説明します。
  • この質問は、VC++でコンパイルエラーが出る問題についてです。初心者の方に対して、エラーの原因や解決方法について解説します。
  • 初心者の方がVC++でコンパイルエラーに遭遇した場合、どのように対処すればよいのでしょうか?この記事では、エラーの内容や解決方法をわかりやすく説明しています。
回答を見る
  • ベストアンサー

VC++でコンパイルエラーが出ますがお教えください。

初心者です。ご教授お願いします。 環境パソコンXP Maicrosoft eMbedded Visual C++ ソースが長すぎる為この欄に入りきれませんので エラー情報にて推測できないでしょうか? エラー内容 Polymo - Win32 (WCE emulator) Debug' 用の中間ファイルおよび出力ファイルを削除しています。 --------------------構成 : Polymo - Win32 (WCE emulator) Debug-------------------- コンパイル中... Polymo.cpp C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(81) : error C2731: 'WinMain' : function cannot be overloaded C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(77) : see declaration of 'WinMain' C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(129) : error C2065: 'WNDCLASSEX' : undeclared identifier C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(129) : error C2146: syntax error : missing ';' before identifier 'wcex' C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(129) : error C2065: 'wcex' : undeclared identifier C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(131) : error C2228: left of '.cbSize' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(133) : error C2228: left of '.style' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(134) : error C2228: left of '.lpfnWndProc' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(135) : error C2228: left of '.cbClsExtra' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(136) : error C2228: left of '.cbWndExtra' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(137) : error C2228: left of '.hInstance' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(138) : error C2228: left of '.hIcon' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(139) : error C2228: left of '.hCursor' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(140) : error C2228: left of '.hbrBackground' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(141) : error C2228: left of '.lpszMenuName' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(142) : error C2228: left of '.lpszClassName' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(143) : error C2228: left of '.hIconSm' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(143) : error C2228: left of '.hInstance' must have class/struct/union type C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(145) : error C2065: 'RegisterClassEx' : undeclared identifier C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(165) : error C2065: 'WS_OVERLAPPEDWINDOW' : undeclared identifier C:\Documents and Settings\中野\デスクトップ\Polymo\Polymo.cpp(251) : error C2664: 'strlen' : cannot convert parameter 1 from 'unsigned short [100]' to 'const char *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast cl.exe の実行エラー Polymo.exe - エラー 20、警告 0 すいませんアドバイスお願い致します。

質問者が選んだベストアンサー

  • ベストアンサー
  • php504
  • ベストアンサー率42% (926/2160)
回答No.1

'WinMain' : function cannot be overloaded から類推するに WinMain( )の戻り値や引数の型が間違っているのではないでしょうか。 って以前も同じエラー出してませんか? http://bekkoame.okwave.jp/qa4237629.html

takaboodes
質問者

お礼

ありがとうございました

その他の回答 (1)

  • pick52
  • ベストアンサー率35% (166/466)
回答No.2

その前に、前の質問の時も思ったのですが個人情報に該当する コンピュータの名前が入った部分は危険なので隠した方がいいでしょう。 毎回毎回エラーが出る度に質問するのではなく、エラーを見て そのエラーの意味を理解し、なぜエラーが出ているのかを推測できる 程度の力がないとプログラミングは難しいのではないかと思います。 (もちろん、自分でそれなりに調べても分からない場合はありますので そうなった時に初めて聴くべきです) エラーコードなどで調べれば大抵の情報は出てくるんじゃないでしょうか。

関連するQ&A

  • 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 で行っております。

  • コンパイルエラーが理解できません

    初心者ですお教えください。 下記ソースを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++のfor文?エラー

    int k2; int es1=0; es1出力する式。 int esti=0; for( k2=0 ; k2<es1 ;k2++){ rep1esti[esti]=rep1estiM[k2], rep2esti[esti]=rep2estiM[k2];  repky1esti[esti]=repky1esti[k2], repky2esti[esti]=repky2estiM[k2], esti=esti+1; } をコンパイルしたとき次のようにエラーが出てきます。 どうすれば、エラーを消せるのでしょうか? よろしくお願いします。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2059: 構文エラー : 'for' c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2143: 構文エラー : ')' が ';' の前にありません。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2143: 構文エラー : ';' が '<' の前にありません。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C4430: 型指定子がありません - int と仮定しました。メモ: C++ は int を既定値としてサポートしていません c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2143: 構文エラー : ';' が '++' の前にありません。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C4430: 型指定子がありません - int と仮定しました。メモ: C++ は int を既定値としてサポートしていません c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2086: 'int k2' : 再定義されました。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : 'k2' の宣言を確認してください。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2059: 構文エラー : ')' c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2143: 構文エラー : ';' が '{' の前にありません。 c:\documents and settings\hiro\デスクトップ\gaibupara\opencvwithdirectshow_v2.0\ransacmotion.cpp(354) : error C2447: '{' : 対応する関数ヘッダーがありません (旧形式の仮引数リスト?)

  • 構文エラーについて教えてください

    申し訳ありません、初心者なので教えてください。 VC2005を使ってプログラミングをしております。 エラーは、以下のようになっております。 見づらいと思いますが、ご親切な方、よろしくお願いします。 申し訳ありません、初心者なので教えてください。 VC2005を使ってプログラミングをしております。 エラーは、以下のようになっております。 見づらいと思いますが、ご親切な方、よろしくお願いします。 c:\program files\microsoft platform sdk\include\mmreg.h : warning C4819: ファイルは、現在のコード ページ (932) で表示できない文字を含んでいます。データの損失を防ぐために、ファイルを Unicode 形式で保存してください。 c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\dxlib.h(1529) : warning C4819: ファイルは、現在のコード ページ (932) で表示できない文字を含んでいます。データの損失を防ぐために、ファイルを Unicode 形式で保存してください。 c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(6) : error C3872: '0x3000': この文字を識別子で使用することはできません c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(7) : error C2144: 構文エラー : 'int' は ';' によって先行されなければなりません。 c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(7) : error C4430: 型指定子がありません - int と仮定しました。メモ: C++ は int を既定値としてサポートしていません c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(7) : error C3872: '0x3000': この文字を識別子で使用することはできません c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(7) : error C3872: '0x3000': この文字を識別子で使用することはできません c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(8) : error C2144: 構文エラー : 'int' は ';' によって先行されなければなりません。 c:\documents and settings\yu-ki-pippi\デスクトップ\dxlib_vc\サンプルプログラム実行用フォルダ\test.cpp(8) : error C4430: 型指定子がありません - int と仮定しました。メモ: C++ は int を既定値としてサポートしていません ブラウザ情報ファイルを作成しています... Microsoft Browse Information Maintenance Utility Version 8.00.50727 Copyright (C) Microsoft Corporation. All rights reserved. ビルドログは "file://c:\Documents and Settings\yu-ki-pippi\デスクトップ\DxLib_VC\サンプルプログラム実行用フォルダ\Debug\BuildLog.htm" に保存されました。 DxLib - エラー 7、警告 2 #include "Dxlib.h" struct CharaData{ int x; //左上座標 int y; int ghandle; //画像ハンドル int life;   //ライフ int image_w; //イメージの大きさ int image_h; int bounds_w; //判定領域の大きさ int bounds_h; }; *エラーをクリックするとこの部分でエラーが出てしまいます。

  • VC++ 2008で別classからFormがincludeできません

    お世話になります。 タイトルの通り、別ソースで書いてあるクラスでForm1のincludeができません。includeすれば、そのclassの型が使用できるという認識なのですが、何か他にしなければならない事があるのでしょうか…。 環境はVisual C++ 2008 Express Editionです。 以下、ソースです。 [Form1.h] #pragma once #include "testclass.h" namespace testAppli { (略) private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { testclass *aaa = new testclass(); aaa->testfunc(this); } [testclass.h] #pragma once #include "stdafx.h" #include "Form1.h" class testclass { public: void testfunc(Form1^ aaa); }; [testclass.cpp] #include "stdafx.h" #include "testclass.h" void testclass::testfunc(Form1^ aaa) { return; } 以下のコンパイルエラーが出ています。 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\Form1.h(98) : error C2065: 'testclass' : 定義されていない識別子です。 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\Form1.h(98) : error C2065: 'aaa' : 定義されていない識別子です。 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\Form1.h(98) : error C2061: 構文エラー : 識別子 'testclass' 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\Form1.h(99) : error C2065: 'aaa' : 定義されていない識別子です。 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\Form1.h(99) : error C2227: '->testfunc' : 左側がクラス、構造体、共用体、ジェネリック型へのポインタではありません。 1> 型は ''unknown-type'' です。 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\testclass.h(8) : error C2061: 構文エラー : 識別子 'Form1' 1>.\testclass.cpp(4) : error C2065: 'Form1' : 定義されていない識別子です。 1>.\testclass.cpp(4) : error C2065: 'aaa' : 定義されていない識別子です。 1>.\testclass.cpp(5) : error C2448: 'testclass::testfunc' : 関数の定義が間違っています。 1>testAppli.cpp 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\testclass.h(8) : error C2061: 構文エラー : 識別子 'Form1' 1>c:\documents and settings\in flames\my documents\visual studio 2008\projects\testappli\testappli\Form1.h(99) : error C2660: 'testclass::testfunc' : 関数に 1 個の引数を指定できません。

  • VC++ のコンパイルエラーについて

    現在、解説書に記載されているコードをVC++でコンパイルできるか試しながらC++を独習中です。エラーの原因と対応が分からず困っております。どなかたご教示よろしくお願いします。 日付を表示するプログラムで米国表示か英国表示にするか列挙型の宣言と静的メンバーをヘッダーファイルに記載し、フラッグの定義と初期化をするプログラムをコンパイルしました。 ---クラス定義(ファイル名:date.h)--- #include <iostream.h> class date{ ----------------------- enum Lang {USA, UK}; static Lang format; public: ----------------------- }; ---メンバー関数定義(ファイル名:date.cpp)--- #include <string.h> #include <ctype.h> #include <stdlib.h> #include "date.h" ----------------------- Lang date::format = USA; ----------------------- ---------------------------------------- このファイルをコンパイルした結果、下記のエラーメッセージが表示されました。 エラー発生箇所は上記「Lang date::format = USA;」でした --------------------構成: date - Win32 Debug-------------------- コンパイル中... date.cpp date.cpp(17) : error C2501: 'Lang' : 識別名を宣言するのに、型が指定されていません。 date.cpp(17) : error C2239: 無効なトークン 'tag::id' が 'Lang' の宣言の後にあらわれました。 date.cpp(17) : error C2321: 構文エラー : 予期しない 'date::format' です。 cl.exe の実行エラー date.obj - エラー 3、警告 0 ----------------------------------------------------------------------------- エラーの原因と解決方法が分かりません。 よろしくお願いします。

  • このエラーの対処法を教えて下さい。

    Visual C++ 2005 Express Edition で、DXライブラリを使ったプログラムをコンパイルすると、 「kamakiri1.cpp(206) : fatal error C1075: 左側 中かっこ '{' に対応するものが 'c:\documents and settings\□\my documents\visual studio 2005\projects\newgame\kamakiri1.cpp(21)' で見つかる前に EOF が検出されました。」と出たのですが、これはどういうエラーなんでしょうか。

  • BCC Developerでのメイクでエラーが出る

    C++を勉強し始めたものですが、BCC Developerでメイクしたときにエラーがでて、コマンドプロンプトが表示されなくて困っています。 http://www.plustarnet.com/aspil/Programming/c00.htmを参考に、 Borland C++ Compiler 5.5とBCC Developer、setbccをインストールし、 http://www.plustarnet.com/aspil/Programming/c01.htmを参考に void main(void) { } という簡単なプログラムをメイクしたのですが、 エラーが出てしまいます。 以下が、そのエラーのときに表示された文です。 > "C:\Program Files\borland\bcc55\Bin\make.exe" -f.\SampleSTG.mak TARGET MAKE Version 5.2 Copyright (c) 1987, 2000 Borland bcc32 -W -3 -Od -w- -AT -pc -H- -k -b -v -y -DDEBUG -n. -c "C:\Documents and Settings\匿名\デスクトップ\SampleSTG\first.cpp" Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland c:\documents and settings\匿名\デベハトップ\samplestg\first.cpp: エラー F1009 c:\documents and settings\匿名\デベハトップ\samplestg\first.cpp: 入力ファイル 'c:\documents and settings\匿名\デベハトップ\samplestg\first.cpp' をオープンできない *** 1 errors in Compile *** ** error 1 ** deleting .\first.obj Make End !! (Elapsed time 0:00.511) エラーの意味もわからないし、ググっても解決法が分からなかったので 書き込みしました。 わかる方、解答お願い致します。

  • 構造体をポインターに入れたい

    構造体をポインターに入れたいのですがうまくいきません どうしたら入れることができますか? ―――ソース――― struct str{  char *name; }; static struct str state_ab[60][4] = {   { { { "いちご" } } , { { "みかん" } } ,{ { "レモン" } } , { { "ブドウ" } } },   { { { "" } } , { { "" } } ,{ { "" } } , { { "" } } }, }; static struct str state_ab2[60][8] = {   { { { "きゅうり" } } , { { "セロリ" } } ,{ { "じゃがいも" } } , { { "にんじん" } } , { { "たまねぎ" } } , { { "ニンニク" } } ,{ { "レタス" } } , { { "キャベツ" } } },   { { { "" } } , { { "" } } ,{ { "" } } , { { "" } } , { { "" } } , { { "" } } ,{ { "" } } , { { "" } } }, }; static struct str state_ab3[60][4] = {   { { { "牛肉" } } , { { "豚肉" } } ,{ { "鶏肉" } } , { { "魚肉" } } },   { { { "" } } , { { "" } } ,{ { "" } } , { { "" } } }, }; char *state_ab_f_read( int mode , int num1 , int num2 ){   struct str *p;   switch( mode ){     case 0: p = state_ab; break;     case 1: p = state_ab2; break;     case 2: p = state_ab3; break;   }   return p[ num1 ][ num2 ].name; } ―――エラー内容――― c:\documents and settings\user\my documents\visual studio 2008\projects\kami\state_ab_fd.cpp(237) : error C2440: '=' : 'str [60][4]' から 'str *' に変換できません。 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。 c:\documents and settings\user\my documents\visual studio 2008\projects\kami\state_ab_fd.cpp(238) : error C2440: '=' : 'str [60][8]' から 'str *' に変換できません。 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。 c:\documents and settings\user\my documents\visual studio 2008\projects\kami\state_ab_fd.cpp(239) : error C2440: '=' : 'str [60][4]' から 'str *' に変換できません。 指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。 c:\documents and settings\user\my documents\visual studio 2008\projects\kami\state_ab_fd.cpp(241) : error C2676: 二項演算子 '[' : 'str' は、この演算子または定義済の演算子に適切な型への変換の定義を行いません。(新しい動作; ヘルプを参照) c:\documents and settings\user\my documents\visual studio 2008\projects\kami\state_ab_fd.cpp(241) : error C2228: '.name' の左側はクラス、構造体、共用体でなければなりません ビルドログは "file://c:\Documents and Settings\USER\My Documents\Visual Studio 2008\Projects\kami\Debug\BuildLog.htm" に保存されました。

  • エラーがでるようになりました。

    vs2005を使っているんですが、 「c:\documents and settings\rm\my documents\visual studio 2005\projects\o.c\o.c.cpp(17) : fatal error C1010: プリコンパイル ヘッダーを検索中に不明な EOF が見つかりました。'#include "stdafx.h"' をソースに追加しましたか?」 というわけの分からない表示が出ました。 どのプログラムも実行できず、この表示が出ます。 急にそうなったんですが、特別なことをした覚えはありません。

専門家に質問してみよう