Problème c++

MounaRM Messages postés 25 Statut Membre -  
oskawa Messages postés 491 Statut Membre -
Bonjour,

A la compilation du projet, j'obtiens l'erreur suivante:

1>.\GestXMP.cpp(19) : error C2061: syntax error : identifier 'Form1'

le code est le suivant:

// GestXMP.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"
using namespace System::Windows::Forms;

//using namespace GestXMP;

//[STAThreadAttribute]

int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it

Application::Run(gcnew Form1());

return 0;
}

Merci d'avance pour l aide
Mouna

1 réponse

  1. oskawa Messages postés 491 Statut Membre 55
     
    Je crois que ça vient du fichier Form1.h, une mauvaise écriture peut être
    0
    1. MounaRM Messages postés 25 Statut Membre
       
      voici le fichier Form1.h . je vois pas ou est le problème !!

      //#pragma once
      #include <windows.h>
      #include <olectl.h>
      #include <ole2.h>
      #include <vcclr.h>
      //#include <iostream>
      #include <string>
      using namespace std;
      using namespace System::Runtime::InteropServices;

      //using namespace std;
      namespace GestXMP {

      using namespace System;
      using namespace System::ComponentModel;
      using namespace System::Collections;
      using namespace System::Windows::Forms;
      using namespace System::Data;
      using namespace System::Drawing;

      /// <summary>
      /// Summary for Form1
      ///
      /// WARNING: If you change the name of this class, you will need to change the
      /// 'Resource File Name' property for the managed resource compiler tool
      /// associated with all .resx files this class depends on. Otherwise,
      /// the designers will not be able to interact properly with localized
      /// resources associated with this form.
      /// </summary>
      public ref class Form1 : public System::Windows::Forms::Form
      {
      public:
      Form1(void)
      {
      InitializeComponent();
      //
      //TODO: Add the constructor code here
      //
      }

      protected:
      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      ~Form1()
      {
      if (components)
      {
      delete components;
      }
      }
      private: System::Windows::Forms::PictureBox^ pBox;
      protected:

      protected:

      protected:
      // private:
      // char* FileName;
      // std::string SFileName;
      private: System::Windows::Forms::Button^ Btn_Image;
      protected:

      private: System::Windows::Forms::Label^ label1;
      private: System::Windows::Forms::Label^ label2;
      private: System::Windows::Forms::TextBox^ TxtcheminOS;
      private: System::Windows::Forms::TextBox^ TxtFileNameOS;
      private: System::Windows::Forms::TextBox^ TxtTailleOS;
      private: System::Windows::Forms::TextBox^ TxtDateCreationOS;





      private: System::Windows::Forms::Label^ label3;
      private: System::Windows::Forms::Label^ label4;
      private: System::Windows::Forms::Label^ label5;
      private: System::Windows::Forms::GroupBox^ groupBox1;
      private: System::Windows::Forms::Label^ label6;
      private: System::Windows::Forms::Label^ label7;
      private: System::Windows::Forms::TextBox^ TxtCreatorXMP;

      private: System::Windows::Forms::TextBox^ TxtTitleXMP;

      private: System::Windows::Forms::Button^ Btn_modifier;
      private: System::Windows::Forms::Button^ Btn_Afficher;
      private: System::Windows::Forms::GroupBox^ groupBox2;
      private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;

      private:
      /// <summary>
      /// Required designer variable.
      /// </summary>
      System::ComponentModel::Container ^components;

      #pragma region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      void InitializeComponent(void)
      {
      this->pBox = (gcnew System::Windows::Forms::PictureBox());
      this->Btn_Image = (gcnew System::Windows::Forms::Button());
      this->label1 = (gcnew System::Windows::Forms::Label());
      this->label2 = (gcnew System::Windows::Forms::Label());
      this->TxtcheminOS = (gcnew System::Windows::Forms::TextBox());
      this->TxtFileNameOS = (gcnew System::Windows::Forms::TextBox());
      this->TxtTailleOS = (gcnew System::Windows::Forms::TextBox());
      this->TxtDateCreationOS = (gcnew System::Windows::Forms::TextBox());
      this->label3 = (gcnew System::Windows::Forms::Label());
      this->label4 = (gcnew System::Windows::Forms::Label());
      this->label5 = (gcnew System::Windows::Forms::Label());
      this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
      this->label6 = (gcnew System::Windows::Forms::Label());
      this->label7 = (gcnew System::Windows::Forms::Label());
      this->TxtCreatorXMP = (gcnew System::Windows::Forms::TextBox());
      this->TxtTitleXMP = (gcnew System::Windows::Forms::TextBox());
      this->Btn_modifier = (gcnew System::Windows::Forms::Button());
      this->Btn_Afficher = (gcnew System::Windows::Forms::Button());
      this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
      this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
      (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pBox))->BeginInit();
      this->groupBox1->SuspendLayout();
      this->groupBox2->SuspendLayout();
      this->SuspendLayout();
      //
      // pBox
      //
      this->pBox->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
      this->pBox->Location = System::Drawing::Point(349, 12);
      this->pBox->Name = L"pBox";
      this->pBox->Size = System::Drawing::Size(136, 148);
      this->pBox->TabIndex = 0;
      this->pBox->TabStop = false;
      //
      // Btn_Image
      //
      this->Btn_Image->Location = System::Drawing::Point(454, 163);
      this->Btn_Image->Name = L"Btn_Image";
      this->Btn_Image->Size = System::Drawing::Size(31, 20);
      this->Btn_Image->TabIndex = 1;
      this->Btn_Image->Text = L"...";
      this->Btn_Image->UseVisualStyleBackColor = true;
      this->Btn_Image->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
      //
      // label1
      //
      this->label1->AutoSize = true;
      this->label1->Location = System::Drawing::Point(413, 168);
      this->label1->Name = L"label1";
      this->label1->Size = System::Drawing::Size(35, 13);
      this->label1->TabIndex = 2;
      this->label1->Text = L"Photo";
      //
      // label2
      //
      this->label2->AutoSize = true;
      this->label2->Location = System::Drawing::Point(23, 23);
      this->label2->Name = L"label2";
      this->label2->Size = System::Drawing::Size(42, 13);
      this->label2->TabIndex = 3;
      this->label2->Text = L"Chemin";
      //
      // TxtcheminOS
      //
      this->TxtcheminOS->Location = System::Drawing::Point(83, 20);
      this->TxtcheminOS->Name = L"TxtcheminOS";
      this->TxtcheminOS->Size = System::Drawing::Size(256, 20);
      this->TxtcheminOS->TabIndex = 4;
      //
      // TxtFileNameOS
      //
      this->TxtFileNameOS->Location = System::Drawing::Point(84, 46);
      this->TxtFileNameOS->Name = L"TxtFileNameOS";
      this->TxtFileNameOS->Size = System::Drawing::Size(256, 20);
      this->TxtFileNameOS->TabIndex = 5;
      //
      // TxtTailleOS
      //
      this->TxtTailleOS->Location = System::Drawing::Point(84, 72);
      this->TxtTailleOS->Name = L"TxtTailleOS";
      this->TxtTailleOS->Size = System::Drawing::Size(256, 20);
      this->TxtTailleOS->TabIndex = 6;
      //
      // TxtDateCreationOS
      //
      this->TxtDateCreationOS->Location = System::Drawing::Point(84, 98);
      this->TxtDateCreationOS->Name = L"TxtDateCreationOS";
      this->TxtDateCreationOS->Size = System::Drawing::Size(256, 20);
      this->TxtDateCreationOS->TabIndex = 7;
      //
      // label3
      //
      this->label3->AutoSize = true;
      this->label3->Location = System::Drawing::Point(23, 49);
      this->label3->Name = L"label3";
      this->label3->Size = System::Drawing::Size(28, 13);
      this->label3->TabIndex = 8;
      this->label3->Text = L"Titre";
      //
      // label4
      //
      this->label4->AutoSize = true;
      this->label4->Location = System::Drawing::Point(23, 79);
      this->label4->Name = L"label4";
      this->label4->Size = System::Drawing::Size(32, 13);
      this->label4->TabIndex = 9;
      this->label4->Text = L"Taille";
      //
      // label5
      //
      this->label5->AutoSize = true;
      this->label5->Location = System::Drawing::Point(7, 105);
      this->label5->Name = L"label5";
      this->label5->Size = System::Drawing::Size(71, 13);
      this->label5->TabIndex = 10;
      this->label5->Text = L"Date création";
      //
      // groupBox1
      //
      this->groupBox1->Controls->Add(this->label6);
      this->groupBox1->Controls->Add(this->label7);
      this->groupBox1->Controls->Add(this->TxtCreatorXMP);
      this->groupBox1->Controls->Add(this->TxtTitleXMP);
      this->groupBox1->Controls->Add(this->Btn_modifier);
      this->groupBox1->Controls->Add(this->Btn_Afficher);
      this->groupBox1->Location = System::Drawing::Point(9, 168);
      this->groupBox1->Name = L"groupBox1";
      this->groupBox1->Size = System::Drawing::Size(333, 113);
      this->groupBox1->TabIndex = 11;
      this->groupBox1->TabStop = false;
      this->groupBox1->Text = L"XMP Attributs";
      //
      // label6
      //
      this->label6->AutoSize = true;
      this->label6->Location = System::Drawing::Point(10, 52);
      this->label6->Name = L"label6";
      this->label6->Size = System::Drawing::Size(41, 13);
      this->label6->TabIndex = 17;
      this->label6->Text = L"Creator";
      //
      // label7
      //
      this->label7->AutoSize = true;
      this->label7->Location = System::Drawing::Point(10, 22);
      this->label7->Name = L"label7";
      this->label7->Size = System::Drawing::Size(28, 13);
      this->label7->TabIndex = 16;
      this->label7->Text = L"Titre";
      //
      // TxtCreatorXMP
      //
      this->TxtCreatorXMP->Location = System::Drawing::Point(71, 45);
      this->TxtCreatorXMP->Name = L"TxtCreatorXMP";
      this->TxtCreatorXMP->Size = System::Drawing::Size(256, 20);
      this->TxtCreatorXMP->TabIndex = 15;
      //
      // TxtTitleXMP
      //
      this->TxtTitleXMP->Location = System::Drawing::Point(71, 19);
      this->TxtTitleXMP->Name = L"TxtTitleXMP";
      this->TxtTitleXMP->Size = System::Drawing::Size(256, 20);
      this->TxtTitleXMP->TabIndex = 14;
      //
      // Btn_modifier
      //
      this->Btn_modifier->Location = System::Drawing::Point(112, 74);
      this->Btn_modifier->Name = L"Btn_modifier";
      this->Btn_modifier->Size = System::Drawing::Size(71, 33);
      this->Btn_modifier->TabIndex = 13;
      this->Btn_modifier->Text = L"&modifier";
      this->Btn_modifier->UseVisualStyleBackColor = true;
      //
      // Btn_Afficher
      //
      this->Btn_Afficher->Location = System::Drawing::Point(20, 74);
      this->Btn_Afficher->Name = L"Btn_Afficher";
      this->Btn_Afficher->Size = System::Drawing::Size(71, 33);
      this->Btn_Afficher->TabIndex = 12;
      this->Btn_Afficher->Text = L"&Afficher";
      this->Btn_Afficher->UseVisualStyleBackColor = true;
      //
      // groupBox2
      //
      this->groupBox2->Controls->Add(this->label5);
      this->groupBox2->Controls->Add(this->label4);
      this->groupBox2->Controls->Add(this->label3);
      this->groupBox2->Controls->Add(this->TxtDateCreationOS);
      this->groupBox2->Controls->Add(this->TxtTailleOS);
      this->groupBox2->Controls->Add(this->TxtFileNameOS);
      this->groupBox2->Controls->Add(this->TxtcheminOS);
      this->groupBox2->Controls->Add(this->label2);
      this->groupBox2->Location = System::Drawing::Point(3, 16);
      this->groupBox2->Name = L"groupBox2";
      this->groupBox2->Size = System::Drawing::Size(346, 134);
      this->groupBox2->TabIndex = 12;
      this->groupBox2->TabStop = false;
      this->groupBox2->Text = L"OS Attributs";
      //
      // openFileDialog1
      //
      this->openFileDialog1->FileName = L"openFileDialog1";
      //
      // Form1
      //
      this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
      this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
      this->ClientSize = System::Drawing::Size(509, 307);
      this->Controls->Add(this->groupBox2);
      this->Controls->Add(this->groupBox1);
      this->Controls->Add(this->label1);
      this->Controls->Add(this->Btn_Image);
      this->Controls->Add(this->pBox);
      this->Name = L"Form1";
      this->Text = L"Form1";
      this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
      (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pBox))->EndInit();
      this->groupBox1->ResumeLayout(false);
      this->groupBox1->PerformLayout();
      this->groupBox2->ResumeLayout(false);
      this->groupBox2->PerformLayout();
      this->ResumeLayout(false);
      this->PerformLayout();

      }
      #pragma endregion

      private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
      {
      this->openFileDialog1->ShowDialog();


      /* if (this->openFileDialog1->FileName != "")
      {
      return;
      }
      */

      this->TxtcheminOS->Text =openFileDialog1->FileName;
      this->TxtFileNameOS ->Text =openFileDialog1->Title ;
      //this->SFileName.ccopy( openFileDialog1->FileName);
      char* path = (char*)(void*)Marshal::StringToHGlobalAnsi(this->TxtcheminOS->Text);
      char* FileName = (char*)(void*)Marshal::StringToHGlobalAnsi(this->TxtcheminOS->Text);

      this->pBox ->Load (this->TxtcheminOS->Text);
      this->pBox ->SizeMode =System::Windows ::Forms ::PictureBoxSizeMode ::StretchImage ;


      }

      private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
      }
      };
      }
      0