Visual studio 2010 VS C+错误+;2010 我的VS 2010 C++快车有问题, 每次我开始构建和调试时,他都会给我这个错误: 问题是,我的朋友有相同的项目和相同的代码,它为他工作,所以我认为在代码中没有问题,但在VS中 我真的需要你的帮助,谢谢你 注:我试着重新插入,但同样的问题

Visual studio 2010 VS C+错误+;2010 我的VS 2010 C++快车有问题, 每次我开始构建和调试时,他都会给我这个错误: 问题是,我的朋友有相同的项目和相同的代码,它为他工作,所以我认为在代码中没有问题,但在VS中 我真的需要你的帮助,谢谢你 注:我试着重新插入,但同样的问题,visual-studio-2010,c++-cli,Visual Studio 2010,C++ Cli,第h部分: #include "Joueur.h" using namespace System; using namespace System::Drawing; using namespace System::Windows::Forms; public ref class Piece { private: Joueur^ proprietaire; // pointeur vers joueur int ligne; int col; String^

第h部分:

#include "Joueur.h"

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;

public ref class Piece
{
private:
    Joueur^ proprietaire;  // pointeur vers joueur
    int ligne;
    int col;
    String^ label;
    Image^ symbole;

public:
    Piece();

    Piece(Joueur^ proprietaire, int ligne, int col, String^ label, Image^ symbole);

    property Joueur^ propProprietaire {
        Joueur^ get();
        void set(Joueur^);
    }

    property int propLigne {
        int get();
        void set(int);
    }

    property int propCol {
        int get();
        void set(int);
    }

    property String^ propLabel {
        String^ get();
        void set(String^);
    }

    property Image^ propSym {
        Image^ get();
        void set(Image^);
    }
};
Piece.cpp:

#include "stdafx.h"
#include "Piece.h"

Piece::Piece() {
    this->proprietaire = nullptr;
    ligne = 0;
    col = 0;
    label = nullptr;
    symbole = nullptr;
}

Piece::Piece(Joueur^ prop, int L, int C, String^ La, Image^ Sym)
{
    this->proprietaire = prop;
    ligne = L;
    col = C;
    label = La;
    symbole = Sym;
}

Joueur^ Piece::propProprietaire::get() {
    return proprietaire;
}

void Piece::propProprietaire::set(Joueur^ prop) {
    this->proprietaire = prop;
}

int Piece::propLigne::get() {
    return ligne;
}

void Piece::propLigne::set(int L) {
    ligne = L;
}

int Piece::propCol::get() {
    return col;
}

void Piece::propCol::set(int C) {
    col = C;
}

String^ Piece::propLabel::get() {
    return label;
}

void Piece::propLabel::set(String^ L) {
    label = L;
}

Image^ Piece::propSym::get() {
    return symbole;
}

void Piece::propSym::set(Image^ IMG) {
    symbole = IMG;
}
Echecs.cpp:

#include "stdafx.h"
#include "Piece.h"
#include "Form1.h"
#include "Form2.h"

using namespace Echecs;

namespace Echecs {

    void Form1::Quitter(Object^  sender, EventArgs^  e) {
        Close();
    }

    void Form2::btnAnnuler_Click(Object^  sender, EventArgs^  e) {
        Close();
    }

    void Form2::btnValider_Click(Object^  sender, EventArgs^  e) {
        Form1::set(tbJoueur1->Text);
        Form1::set2(tbJoueur2->Text);
        Close();
    }

    void Form1::Menu_NouvellePartie(Object^  sender, EventArgs^  e) {
        Form2^ frm = gcnew Form2();
        frm->ShowDialog();
    }

    void Form1::NouvellePartie() {
        ListeJoueurs = gcnew array<Joueur^>(2);  // Instancier un tableau à 1 dimensio, de 2 éléménts
        ListeJoueurs[0] = gcnew Joueur("Joueur 1", lbCoups1);
        ListeJoueurs[1] = gcnew Joueur("Joueur 2", lbCoups2);
        lbJoueur1->Text = ListeJoueurs[0]->propNom;
        lbJoueur2->Text = ListeJoueurs[1]->propNom;

        grille = gcnew array<Piece^, 2>(8,8);  // Instancier un tableau à 2 dimensions, de taille 8x8
        for(int i=0 ; i<8 ; i++)
            for(int j=0 ; j<8 ; j++)
                grille[i,j] = nullptr;  // Initialiser chacun de ses éléments à NULL

        // Initialisation de la grille pour le Joueur 1 (ligne 0 & 1)
        grille[0,0] = gcnew Piece(ListeJoueurs[0], 0, 0, "Tour", Pieces->Images[0]);
        grille[0,1] = gcnew Piece(ListeJoueurs[0], 0, 1, "Cavalier", Pieces->Images[1]);
        grille[0,2] = gcnew Piece(ListeJoueurs[0], 0, 2, "Fou", Pieces->Images[2]);
        grille[0,3] = gcnew Piece(ListeJoueurs[0], 0, 3, "Roi", Pieces->Images[3]);
        grille[0,4] = gcnew Piece(ListeJoueurs[0], 0, 4, "Dame", Pieces->Images[4]);
        grille[0,5] = gcnew Piece(ListeJoueurs[0], 0, 5, "Fou", Pieces->Images[2]);
        grille[0,6] = gcnew Piece(ListeJoueurs[0], 0, 6, "Cavalier", Pieces->Images[1]);
        grille[0,7] = gcnew Piece(ListeJoueurs[0], 0, 7, "Tour", Pieces->Images[0]);
        for(int j=0 ; j<8 ; j++)
            grille[1,j] = gcnew Piece(ListeJoueurs[0], 1, j, "Pion", Pieces->Images[5]);

        // Initialisation de la grille pour le Joueur 2 (ligne 6 & 7)
        grille[7,0] = gcnew Piece(ListeJoueurs[1], 7, 0, "Tour", Pieces->Images[6]);
        grille[7,1] = gcnew Piece(ListeJoueurs[1], 7, 1, "Cavalier", Pieces->Images[7]);
        grille[7,2] = gcnew Piece(ListeJoueurs[1], 7, 2, "Fou", Pieces->Images[8]);
        grille[7,3] = gcnew Piece(ListeJoueurs[1], 7, 3, "Roi", Pieces->Images[9]);
        grille[7,4] = gcnew Piece(ListeJoueurs[1], 7, 4, "Dame", Pieces->Images[10]);
        grille[7,5] = gcnew Piece(ListeJoueurs[1], 7, 5, "Fou", Pieces->Images[8]);
        grille[7,6] = gcnew Piece(ListeJoueurs[1], 7, 6, "Cavalier", Pieces->Images[7]);
        grille[7,7] = gcnew Piece(ListeJoueurs[1], 7, 7, "Tour", Pieces->Images[6]);
        for(int j=0 ; j<8 ; j++)
            grille[6,j] = gcnew Piece(ListeJoueurs[1], 6, j, "Pion", Pieces->Images[11]);

        /* Pion, Pion, Pion, Pion, Pion, Pion, Pion, Pion
           Tour, Cavalier, Fou, Roi, Dame, Fou, Cavalier, Tour */

        // Instanciation des cases du tableau Tab
        Tab[0,0] = case_0_0;     Tab[0,1] = case_0_1;     Tab[0,2] = case_0_2;     Tab[0,3] = case_0_3;
        Tab[0,4] = case_0_4;     Tab[0,5] = case_0_5;     Tab[0,6] = case_0_6;     Tab[0,7] = case_0_7;
        Tab[1,0] = case_1_0;     Tab[1,1] = case_1_1;     Tab[1,2] = case_1_2;     Tab[1,3] = case_1_3;
        Tab[1,4] = case_1_4;     Tab[1,5] = case_1_5;     Tab[1,6] = case_1_6;     Tab[1,7] = case_1_7;
        Tab[2,0] = case_2_0;     Tab[2,1] = case_2_1;     Tab[2,2] = case_2_2;     Tab[2,3] = case_2_3;
        Tab[2,4] = case_2_4;     Tab[2,5] = case_2_5;     Tab[2,6] = case_2_6;     Tab[2,7] = case_2_7;
        Tab[3,0] = case_3_0;     Tab[3,1] = case_3_1;     Tab[3,2] = case_3_2;     Tab[3,3] = case_3_3;
        Tab[3,4] = case_3_4;     Tab[3,5] = case_3_5;     Tab[3,6] = case_3_6;     Tab[3,7] = case_3_7;
        Tab[4,0] = case_4_0;     Tab[4,1] = case_4_1;     Tab[4,2] = case_4_2;     Tab[4,3] = case_4_3;
        Tab[4,4] = case_4_4;     Tab[4,5] = case_4_5;     Tab[4,6] = case_4_6;     Tab[4,7] = case_4_7;
        Tab[5,0] = case_5_0;     Tab[5,1] = case_5_1;     Tab[5,2] = case_5_2;     Tab[5,3] = case_5_3;
        Tab[5,4] = case_5_4;     Tab[5,5] = case_5_5;     Tab[5,6] = case_5_6;     Tab[5,7] = case_5_7;
        Tab[6,0] = case_6_0;     Tab[6,1] = case_6_1;     Tab[6,2] = case_6_2;     Tab[6,3] = case_6_3;
        Tab[6,4] = case_6_4;     Tab[6,5] = case_6_5;     Tab[6,6] = case_6_6;     Tab[6,7] = case_6_7;
        Tab[7,0] = case_7_0;     Tab[7,1] = case_7_1;     Tab[7,2] = case_7_2;     Tab[7,3] = case_7_3;
        Tab[7,4] = case_7_4;     Tab[7,5] = case_7_5;     Tab[7,6] = case_7_6;     Tab[7,7] = case_7_7;

        for(int i=0 ; i<8 ; i++)
            for(int j=0 ; j<8 ; j++) {
                Affichage(grille[i,j]);
                Tab[i,j]->BackColor = Color::Transparent;
            }
    }

    void Form1::Affichage(Piece^ P) {
        int L = P->propLigne;
        int C = P->propCol;
        Tab[L,C]->Image = P->propSym;
    }

    void Form1::set(String^ n) {
        lbJoueur1->Text = n;
    }

    void Form1::set2(String^ n)
    {
        lbJoueur2->Text=n;
    }

    void Form1::Deplacer(Object^  sender, EventArgs^  e) {
        Point coordonnees = (Point)(((PictureBox^)sender)->Tag) ;
        int L = coordonnees.X;     int C = coordonnees.Y;
        if ((grille[L,C] != nullptr) && (NClick != 1)) {
            NClick = 1;   L1=L;   C1=C;
            Tab[L,C]->BackColor = Color::Yellow;
            Pc = grille[L,C];
            DeplacementAutorise(grille[L,C]);
        }

        else if ((grille[L,C] == nullptr) && (NClick == 1)) {
            Tab[L,C]->Image = Pc->propSym;
            grille[L,C] = Pc;
            Tab[L1,C1]->Image = nullptr;
            grille[L1,C1] = nullptr;
            NClick = 0;
            for(int i=0 ; i<8 ; i++)
                for(int j=0 ; j<8 ; j++)
                    Tab[i,j]->BackColor = Color::Transparent;
        }

        else if ((grille[L,C] != nullptr) && (NClick == 1)) {
            for(int i=0 ; i<8 ; i++)
                for(int j=0 ; j<8 ; j++)
                    Tab[i,j]->BackColor = Color::Transparent;
            Tab[L,C]->BackColor = Color::Yellow;
            Pc = grille[L,C];
            DeplacementAutorise(grille[L,C]);
        }
    }

    void Form1::DeplacementAutorise(Piece^ P) {
        int L = P->propLigne;     int C = P->propCol;
        String^ Lab = P->propLabel;

        if (Lab == "Cavalier") {
            if ((L+2<=7) && (C+1<=7))
                Tab[L+2,C+1]->BackColor = Color::Cyan;
            if ((L+1<=7) && (C+2<=7))
                Tab[L+1,C+2]->BackColor = Color::Cyan;
            if ((L+2<=7) && (C-1>=0))
                Tab[L+2,C-1]->BackColor = Color::Cyan;
            if ((L+1<=7) && (C-2>=0))
                Tab[L+1,C-2]->BackColor = Color::Cyan;
            if ((L-1>=0) && (C+2<=7))
                Tab[L-1,C+2]->BackColor = Color::Cyan;
            if ((L-2>=0) && (C+1<=7))
                Tab[L-2,C+1]->BackColor = Color::Cyan;
            if ((L-1>=0) && (C-2>=0))
                Tab[L-1,C-2]->BackColor = Color::Cyan;
            if ((L-2>=0) && (C-1>=0))
                Tab[L-2,C-1]->BackColor = Color::Cyan;
        }

        if (Lab == "Pion") {
            if (grille[L+1,C] == nullptr)
                Tab[L+1,C]->BackColor = Color::Cyan;
        }

        if (Lab == "Fou");


        /*if ((L+1<=7) && (C+1<=7))
          if (grille[L+1,C+1] == nullptr) {
          while ((L+1<=7) && (C+1<=7)) {
          Tab[L+1,C+1]->BackColor = Color::Cyan;
          L++; C++;
          }}
          if ((L+1<=7) && (C-1>=0)) {
          while ((L+1<=7) && (C-1>=0)) {
          Tab[L+1,C-1]->BackColor = Color::Cyan;
          L++; C++;
          }}*/




    }

    void Form1::Form1_Load(Object^  sender, EventArgs^  e) {
        NouvellePartie();
    }
}


int main(array<System::String ^> ^args)
{
    // Activation des effets visuels de Windows XP avant la création de tout contrôle
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    // Créer la fenêtre principale et l'exécuter
    Application::Run(gcnew Form1());
    return 0;
}
#包括“stdafx.h”
#包括“工件h”
#包括“表格1.h”
#包括“表格2.h”
使用名称空间ECS;
名称空间ECECS{
void Form1::Quitter(对象^sender,事件参数^e){
Close();
}
void Form2::bTNanuler\u单击(对象^sender,事件参数^e){
Close();
}
void Form2::btnValider\u单击(对象^sender,事件参数^e){
Form1::set(TBJouer1->Text);
Form1::set2(TB2->Text);
Close();
}
void Form1::Menu_NouvellePartie(对象^sender,事件参数^e){
Form2^frm=gcnewform2();
frm->ShowDialog();
}
void Form1::NouvellePartie(){
ListJouers=gcnew数组(2);//表的1维实例,2éléménts
ListJouers[0]=gcnew Jouer(“Jouer 1”,lbCoups1);
ListJouers[1]=gcnew Jouer(“Jouer 2”,lbCoups2);
lbjouer1->Text=listejouers[0]->propNom;
lbjouer2->Text=listejouers[1]->propNom;
格栅=gcnew阵列(8,8);//2维表中的Instancier,de taille 8x8
对于(inti=0;iImages[1]);
格栅[0,2]=gcnew Piece(ListJouers[0],0,2,“Fou”,Pieces->Images[2]);
格栅[0,3]=gcnew Piece(ListJouers[0],0,3,“Roi”,Pieces->Images[3]);
格栅[0,4]=gcnew Piece(ListJouers[0],0,4,“Dame”,Pieces->Images[4]);
格栅[0,5]=gcnew工件(ListJouers[0],0,5,“Fou”,工件->图像[2]);
格栅[0,6]=gcnew件(ListJouers[0],0,6,“骑士”,件->图像[1]);
格栅[0,7]=gcnew Piece(ListJouers[0],0,7,“Tour”,Pieces->Images[0]);
对于(int j=0;jImages[5]);
//2号焦耳炉格栅的初始化(6号和7号线)
格栅[7,0]=gcnew Piece(ListJouers[1],7,0,“Tour”,Pieces->Images[6]);
格栅[7,1]=gcnew单品(ListJouers[1],7,1,“骑士”,单品->图像[7]);
格栅[7,2]=gcnew Piece(ListJouers[1],7,2,“Fou”,Pieces->Images[8]);
格栅[7,3]=gcnew Piece(ListJouers[1],7,3,“Roi”,Pieces->Images[9]);
格栅[7,4]=gcnew Piece(ListJouers[1],7,4,“Dame”,Pieces->Images[10]);
格栅[7,5]=gcnew Piece(ListJouers[1],7,5,“Fou”,Pieces->Images[8]);
格栅[7,6]=gcnew单品(ListJouers[1],7,6,“骑士”,单品->图像[7]);
格栅[7,7]=gcnew Piece(ListJouers[1],7,7,“Tour”,Pieces->Images[6]);
对于(int j=0;jImages[11]);
/*π,π,π,π,π,π,π,π,π
巡回赛,骑士,福,罗伊,夫人,福,骑士,巡回赛*/
//表中案例实例选项卡
Tab[0,0]=案例0\u 0;Tab[0,1]=案例0\u 1;Tab[0,2]=案例0\u 2;Tab[0,3]=案例0\u 3;
Tab[0,4]=案例0\u4;Tab[0,5]=案例0\u5;Tab[0,6]=案例0\u6;Tab[0,7]=案例0\u7;
Tab[1,0]=案例1\u 0;Tab[1,1]=案例1\u 1;Tab[1,2]=案例1\u 2;Tab[1,3]=案例1\u 3;
Tab[1,4]=案例1\u4;Tab[1,5]=案例1\u5;Tab[1,6]=案例1\u6;Tab[1,7]=案例1\u7;
Tab[2,0]=案例2\u0;Tab[2,1]=案例2\u1;Tab[2,2]=案例2\u2;Tab[2,3]=案例2\u3;
Tab[2,4]=案例2\u4;Tab[2,5]=案例2\u5;Tab[2,6]=案例2\u6;Tab[2,7]=案例2\u7;
Tab[3,0]=案例3\u 0;Tab[3,1]=案例3\u 1;Tab[3,2]=案例3\u 2;Tab[3,3]=案例3\u 3;
Tab[3,4]=案例3\u4;Tab[3,5]=案例3\u5;Tab[3,6]=案例3\u6;Tab[3,7]=案例3\u7;
Tab[4,0]=案例4\u 0;Tab[4,1]=案例4\u 1;Tab[4,2]=案例4\u 2;Tab[4,3]=案例4\u 3;
Tab[4,4]=案例四;Tab[4,5]=案例四;Tab[4,6]=案例六;Tab[4,7]=案例四;
Tab[5,0]=案例5\u 0;Tab[5,1]=案例5\u 1;Tab[5,2]=案例5\u 2;Tab[5,3]=案例5\u 3;
Tab[5,4]=案例5\u4;Tab[5,5]=案例5\u5;Tab[5,6]=案例5\u6;Tab[5,7]=案例5\u7;
Tab[6,0]=案例6\u0;Tab[6,1]=案例6\u1;Tab[6,2]=案例6\u2;Tab[6,3]=案例6\u3;
Tab[6,4]=案例6\u4;Tab[6,5]=案例6\u5;Tab[6,6]=案例6\u6;Tab[6,7]=案例6\u7;
Tab[7,0]=案例7\u0;Tab[7,1]=案例7\u1;Tab[7,2]=案例7\u2;Tab[7,3]=案例7\u3;
Tab[7,4]=案例7\u4;Tab[7,5]=案例7\u5;Tab[7,6]=案例7\u6;Tab[7,7]=案例7\u7;
对于(inti=0;ipropLigne;
INTC=P->propCol;
Tab[L,C]->Image=P->propSym;
}
void Form1::set(字符串^n){
lbjouer1->Text=n;
}
void Form1::set2(字符串^n)
{
lbjouer2->Text=n;
}
void Form1::Deplacer(对象^sender,事件参数^e){
点坐标=(点)((图片框^)发送方)->标记;
int L=coordones.X;int C=coordones.Y;
如果((格栅[L,C]!=nullptr)&&(单击!=1)){
NClick=1;L1=L;C1=C;
标签[L,C]->背景色=颜色::黄色;
Pc=格栅[L,C];
移位自动复位(格栅[L,C]);
}
否则如果((格栅[L,C]==nullptr)和&(NClick==1)){
选项卡[L,C]->Image=Pc->propSym;
格栅[L,C]=Pc;
Tab[L1,C1]->Image=nullptr;
格栅[L1,C1]=零位PTR;
NClick=0;
对于(inti=0;ipropLigne;intc=P->propCol;
字符串^Lab=P->propLabel;
如果(实验室==“骑士”){
如果((L+2BackColor=颜色::青色;
如果((L-1>=0)和&(C+2BackColor=Color::青色;
如果((L-2>=0)和&(C+1BackColor=Color::青色;
如果((L-1>=0)和&(C-2>=0))
选项卡[L-1,C-2]->背景色=颜色::青色;