Hi! I want to make a CONVERTER. I designed it, so I just have to program some buttons. The problem that I have is weird. I programmed a button that says : CONVERT TO METER. After I build the program, I get ERROR C1075 : end of file found before the left brace '{', I don't know why.

#pragma once
#include "iostream"
#include "cmath"

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


namespace My875346 {

    /// <summary>
    /// Summary for CMtoM
    ///
    /// 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 CMtoM : public System::Windows::Forms::Form
    {
    public:
        CMtoM(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }

    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~CMtoM()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Label^  label1;

    private: System::Windows::Forms::Label^  label2;

    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::TextBox^  textBox2;
    private: System::Windows::Forms::Label^  label4;

    protected: 

    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->button1 = (gcnew System::Windows::Forms::Button());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->label4 = (gcnew System::Windows::Forms::Label());
            this->SuspendLayout();
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(619, 252);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(114, 32);
            this->button1->TabIndex = 0;
            this->button1->Text = L"BACK";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &CMtoM::button1_Click);
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Location = System::Drawing::Point(199, 126);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(67, 13);
            this->label1->TabIndex = 1;
            this->label1->Text = L"CM amount: ";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Location = System::Drawing::Point(369, 126);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(13, 13);
            this->label2->TabIndex = 3;
            this->label2->Text = L"=";
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Location = System::Drawing::Point(388, 126);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(16, 13);
            this->label3->TabIndex = 5;
            this->label3->Text = L"M";
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(263, 178);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(247, 23);
            this->button2->TabIndex = 9;
            this->button2->Text = L"Convert to Meter";
            this->button2->Click += gcnew System::EventHandler(this, &CMtoM::button2_Click);
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(263, 123);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(100, 20);
            this->textBox1->TabIndex = 7;
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(410, 123);
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(100, 20);
            this->textBox2->TabIndex = 8;
            // 
            // label4
            // 
            this->label4->AutoSize = true;
            this->label4->Location = System::Drawing::Point(25, 270);
            this->label4->Name = L"label4";
            this->label4->Size = System::Drawing::Size(35, 13);
            this->label4->TabIndex = 10;
            this->label4->Text = L"label4";
            this->label4->Visible = false;
            // 
            // CMtoM
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(745, 296);
            this->Controls->Add(this->label4);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->label3);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->Controls->Add(this->button1);
            this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
            this->Name = L"CMtoM";
            this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
            this->Text = L"Beta-Converter / Length / CMtoM";
            this->ResumeLayout(false);
            this->PerformLayout();

        }
#pragma endregion
                private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

                this->Close();

                         }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {

             char c; double x,y;
             this->label4->Text = "1"; c='1';

             x = System::Convert::ToInt32(this->textBox1->Text);

             switch(c)
             {
             case '1': y=x/100; break;

         }
             this->textBox2->Text = System::Convert::ToString(y);
};
}

Build Log :
1>------ Build started: Project: 875346, Configuration: Debug Win32 ------
1>Compiling...
1>CMtoM.cpp
1>.\CMtoM.cpp(4) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\toth family\documents\visual studio 2008\projects\875346\875346\CMtoM.h(13)' was matched
1>LENGTH.cpp
1>c:\users\toth family\documents\visual studio 2008\projects\875346\875346\MtoCM.h(3) : error C2143: syntax error : missing ';' before 'using'
1>.\LENGTH.cpp(3) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\toth family\documents\visual studio 2008\projects\875346\875346\CMtoM.h(13)' was matched
1>875346.cpp
1>c:\users\toth family\documents\visual studio 2008\projects\875346\875346\MtoCM.h(3) : error C2143: syntax error : missing ';' before 'using'
1>.\875346.cpp(20) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\toth family\documents\visual studio 2008\projects\875346\875346\CMtoM.h(13)' was matched
1>Generating Code...
1>Build log was saved at "file://c:\Users\Toth Family\Documents\Visual Studio 2008\Projects\875346\875346\Debug\BuildLog.htm"
1>875346 - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is NOT a c++ program, but a language called CLR/C++, they are not the same nor do they use the same header files/libraries. CLR/C++ is more closely related to C# then C++. You cannot use iostream or cmath, or any other of the libraries/functions from standard c++ library or header files. Instead, you have to use the .NET functions and classes. Delete the iostream and cmath header files.

I deleted iostream and cmath, nothing changed. I don't know what is the problem.

You appear to have a problem with your braces. It looks to me like you're missing a closing brace at the end. Also I'm not sure if the one at line 192 needs a semi-colon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.