Question: Get Two error messages when I try to run Program. I am using Microsoft visuals. Please Edit/change and Highlight the errors. Thank you Get error

Get Two error messages when I try to run Program. I am using Microsoft visuals. Please Edit/change and Highlight the errors. Thank you
Get error LNK2005: int__clrcall main( cli::array^)"
(?main@@$$HYMHP$01AP$AAVString@System@@@Z) already defined in Program3.obj H:\Project3.a\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1.obj WindowsFormsApplication1
Get error LNK1169: One or more multiple defined symbols found
//HeaderFiler
#ifndef TInventory_H
#define TInventory_H
#include
#include
#include
using namespace std;
using namespace System;
using namespace System::IO;
using namespace System::Windows::Forms;
using namespace System::Runtime::InteropServices;
class TInventory
{
private:
int ProductId;
mutable char ProductDescription[35];
int ManufactureId;
double WholesalePrice;
double MarkUpPercentage;
int ProductQuantity;
TInventory* NextRecordPointer;
public:
//*************
//Constructors*
//*************
TInventory( );
void ListRecords (char*);
void InsertItem(int, char[], int, double, double, int, TInventory*);
int CountItems(); //added
TInventory( int, char [], int, double, double, int );
//Returns private memebers
int GetProductIdNumber ( ) const;
char* GetProductDescription ( ) const;
int GetManufactureId ( ) const;
double GetWholesalePrice ( ) const;
double GetMarkUpPercentage ( ) const;
int GetProductQuantity () const;
TInventory* GetLink() const;
double RetailPrice() const;
//Display Information about the inventory
void SetProductIDNumber (int);
void SetProductDescription (char [ ]);
void SetManufactureId (int);
void SetWholesalePrice (double);
void SetMarkUpPercentage(double);
void SetProductQuantity(int);
void SetLink(TInventory*);
};
#endif
Form1.h
#pragma once
namespace WindowsFormsApplication1 {
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 for Form
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
///
/// Clean up any resources being used.
///
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Panel^ panel1;
protected:
private: System::Windows::Forms::GroupBox^ groupBox2;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Button^ Exit_Button;
private: System::Windows::Forms::Button^ Report_Button;
private: System::Windows::Forms::TextBox^ Report_Textbox;
private: System::Windows::Forms::PictureBox^ pictureBox1;
protected:
private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->Exit_Button = (gcnew System::Windows::Forms::Button());
this->Report_Button = (gcnew System::Windows::Forms::Button());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->Report_Textbox = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label = (gcnew System::Windows::Forms::Label());
this->panel1->SuspendLayout();
this->groupBox2->SuspendLayout();
this->groupBox1->SuspendLayout();
(cli::safe_cast<:componentmodel::isupportinitialize>(this->pictureBox1))->BeginInit();
this->SuspendLayout();
//
// panel1
//
this->panel1->BackColor = System::Drawing::Color::Ivory;
this->panel1->Controls->Add(this->groupBox2);
this->panel1->Controls->Add(this->groupBox1);
this->panel1->Dock = System::Windows::Forms::DockStyle::Fill;
this->panel1->Location = System::Drawing::Point(0, 0);
this->panel1->Margin = System::Windows::Forms::Padding(4);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(798, 208);
this->panel1->TabIndex = 0;
//
// groupBox2
//
this->groupBox2->Controls->Add(this->label3);
this->groupBox2->Controls->Add(this->label2);
this->groupBox2->Controls->Add(this->Exit_Button);
this->groupBox2->Controls->Add(this->Report_Button);
this->groupBox2->Location = System::Drawing::Point(466, 12);
this->groupBox2->Name = L"groupBox2";
this->groupBox2->Size = System::Drawing::Size(316, 175);
this->groupBox2->TabIndex = 2;
this->groupBox2->TabStop = false;
this->groupBox2->Enter += gcnew System::EventHandler(this, &Form1::groupBox2_Enter);
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->label3->Location = System::Drawing::Point(137, 119);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(111, 20);
this->label3->TabIndex = 3;
this->label3->Text = L"Exit Program";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->label2->Location = System::Drawing::Point(137, 47);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(97, 20);
this->label2->TabIndex = 2;
this->label2->Text = L"Create List";
//
// Exit_Button
//
this->Exit_Button->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->Exit_Button->Location = System::Drawing::Point(22, 109);
this->Exit_Button->Name = L"Exit_Button";
this->Exit_Button->Size = System::Drawing::Size(89, 42);
this->Exit_Button->TabIndex = 2;
this->Exit_Button->Text = L"E&xit";
this->Exit_Button->UseVisualStyleBackColor = true;
this->Exit_Button->Click += gcnew System::EventHandler(this, &Form1::Exit_Button_Click);
//
// Report_Button
//
this->Report_Button->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->Report_Button->Location = System::Drawing::Point(22, 34);
this->Report_Button->Name = L"Report_Button";
this->Report_Button->Size = System::Drawing::Size(89, 42);
this->Report_Button->TabIndex = 1;
this->Report_Button->Text = L"&Report";
this->Report_Button->UseVisualStyleBackColor = true;
this->Report_Button->Click += gcnew System::EventHandler(this, &Form1::Report_Button_Click);
//
// groupBox1
//
this->groupBox1->Controls->Add(this->pictureBox1);
this->groupBox1->Controls->Add(this->Report_Textbox);
this->groupBox1->Controls->Add(this->label1);
this->groupBox1->Controls->Add(this->label);
this->groupBox1->Location = System::Drawing::Point(12, 12);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(436, 175);
this->groupBox1->TabIndex = 1;
this->groupBox1->TabStop = false;
//
// pictureBox1
//
this->pictureBox1->Image = (cli::safe_cast<:drawing::image>(resources->GetObject(L"pictureBox1.Image")));
this->pictureBox1->Location = System::Drawing::Point(7, 13);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(134, 110);
this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->pictureBox1->TabIndex = 3;
this->pictureBox1->TabStop = false;
//
// Report_Textbox
//
this->Report_Textbox->Location = System::Drawing::Point(148, 137);
this->Report_Textbox->Name = L"Report_Textbox";
this->Report_Textbox->Size = System::Drawing::Size(251, 22);
this->Report_Textbox->TabIndex = 0;
this->Report_Textbox->Click += gcnew System::EventHandler(this, &Form1::Report_Textbox_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->label1->Location = System::Drawing::Point(166, 23);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(224, 100);
this->label1->TabIndex = 2;
this->label1->Text = L"Please Enter The Heading Of The Report And Press The \"Report\" Button";
//
// label
//
this->label->AutoSize = true;
this->label->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->label->Location = System::Drawing::Point(8, 138);
this->label->Name = L"label";
this->label->Size = System::Drawing::Size(133, 20);
this->label->TabIndex = 1;
this->label->Text = L"Report Header:";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(798, 208);
this->Controls->Add(this->panel1);
this->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<:byte>(0)));
this->Margin = System::Windows::Forms::Padding(4);
this->Name = L"Form1";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = L"Office Supply Company";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->panel1->ResumeLayout(false);
this->groupBox2->ResumeLayout(false);
this->groupBox2->PerformLayout();
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
(cli::safe_cast<:componentmodel::isupportinitialize>(this->pictureBox1))->EndInit();
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void groupBox2_Enter(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void Exit_Button_Click(System::Object^ sender, System::EventArgs^ e)
{
//This will exit the Application
Application::Exit();
}
private: System::Void Report_Textbox_Click(System::Object^ sender, System::EventArgs^ e)
{
//This will clear the textbox
Report_Textbox->Clear();
}
private: System::Void Report_Button_Click(System::Object^ sender, System::EventArgs^ e)
{
TInventory* CurrentRecordPointer;
ifstream DataFile;
int InitProductId = 0;
char InitProductDescription[35] = "\0";
int InitManufacturerId = 0;
double InitWholesalePrice = 0.0;
double InitMarkUp = 0.0;
int InitQuantity = 0;
char* ReportName;
DataFile.open((char*)(void*)Marshal::StringToHGlobalAnsi
(String::Concat(Directory::GetCurrentDirectory(),
"\\ProductFileForInput.txt")));
if (!DataFile)
{
Application::Exit();
return;
}
//***************************************
//Read input data from external data file
//***************************************
DataFile>>InitProductId;
DataFile>>InitManufacturerId;
DataFile>>InitWholesalePrice;
DataFile>>InitMarkUp;
DataFile.ignore();
DataFile.get(InitProductDescription, 31);
DataFile>>InitQuantity;
while(DataFile)
{
CurrentRecordPointer = new TInventory;
CurrentRecordPointer->InsertItem(InitProductId, InitProductDescription,
InitManufacturerId, InitWholesalePrice,
InitMarkUp, InitQuantity, CurrentRecordPointer);
DataFile>>InitProductId;
DataFile>>InitManufacturerId;
DataFile>>InitWholesalePrice;
DataFile>>InitMarkUp;
DataFile.ignore();
DataFile.get(InitProductDescription, 31);
DataFile>>InitQuantity;
}//end of while brace
ReportName=(char*)(void*)Marshal::StringToHGlobalAnsi
(Report_Textbox->Text);
FirstRecordPointer->ListRecords(ReportName);
Report_Textbox->Clear();
Report_Textbox->Text="OUTPUT FILE CREATED";
delete CurrentRecordPointer;
FirstRecordPointer = NULL;
DataFile.close();
}//end of reportbutton brace
};
}
Stadafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once
// TODO: reference additional headers your program requires here
#include "TInventory.h"
extern TInventory* FirstRecordPointer;
// WindowsFormsApplication1.cpp : main project file.
#include "stdafx.h"
#include "Form.h"
using namespace WindowsFormsApplication1;
[STAThreadAttribute]
int main(array<: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;
}
//Implementation File
//Filename: TInventory.cpp
#include "stdafx.h"
#include "TInventory.h"
TInventory * FirstRecordPointer;
//Constructors
TInventory::TInventory( )
{
ProductId=0;
ProductDescription[34] = '\0';
ManufactureId = 0;
WholesalePrice = 0;
MarkUpPercentage = 0;
ProductQuantity = 0;
NextRecordPointer = NULL;
}
// ************************************
// * Write the contents of the linked *
// * list to an external report file *
// ************************************
void TInventory::ListRecords(char*ReportName)
{
ofstream OutputFile;
TInventory*CurrentRecordPointer;
char Separator[100] = "________________________________________________________________________________________";
OutputFile.open((char*)(void*)Marshal::StringToHGlobalAnsi(String::Concat(Directory::GetCurrentDirectory(),
"//ProductFileForOutput.txt")));
if (!OutputFile)
{
Application::Exit();
return;
}
// ********************************************
// * Display header for inventory information *
// ********************************************
OutputFile
OutputFile
OutputFile
OutputFile
// **********************************************************
// * Records are listed until the NULL value is encountered *
 Get Two error messages when I try to run Program. I
Office Supply Company ?? Please Enter The Heading of The Report And Press The "Report" Button Report Create List Exit Exit Program Report Header: Office Supply Company ?? Please Enter The Heading of The Report And Press The "Report" Button Report Create List Exit Exit Program Report Header

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!